The Trunk: Tools-mt.989.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-mt.989.mcz

commits-2
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.989.mcz

==================== Summary ====================

Name: Tools-mt.989
Author: mt
Time: 29 September 2020, 10:06:06.429444 am
UUID: 5730f8ac-96c7-6c41-be31-f2c51310ad53
Ancestors: Tools-ct.988

In debuggers, unify run-until/to logic, which also skips unnecessary UI updates to speed up "run to here" again.

=============== Diff against Tools-ct.988 ===============

Item was added:
+ ----- Method: Debugger>>doStepUntil: (in category 'context stack menu') -----
+ doStepUntil: condition
+ "Step until the given condition evaluates to other than false, reporting an error it if does not evaluate to true.
+
+ If shift is pressed when the expression is supplied, don't update the UI. If shift is pressed while stepping, stop stepping. Using a user interrupt to break out would be more natural but Squeak currently doesn't provide a UserInterrupt exception. It should do."
+
+ | currentContext newContext value lastUpdate updateUI breakOnShift |
+ self okToChange ifFalse: [^ self].
+ self checkContextSelection.
+ currentContext := newContext := self selectedContext.
+ lastUpdate := Time millisecondClockValue.
+ updateUI := breakOnShift := Sensor shiftPressed not.
+
+ Cursor execute showWhile: [[
+ newContext == currentContext
+ and: [currentContext willReturn not
+ and: [(value := condition value) == false]] ] whileTrue: [
+
+ self
+ handleLabelUpdatesIn: [newContext := interruptedProcess completeStep: currentContext]
+ whenExecuting: currentContext.
+ newContext == currentContext ifTrue: [
+ newContext := interruptedProcess stepToSendOrReturn.
+ self resetContext: newContext changeContents: false].
+
+ Time millisecondClockValue - lastUpdate > 250 "ms" ifTrue: [
+ updateUI ifTrue: [
+ self changed: #contentsSelection.
+ Project current world displayWorldSafely].
+ breakOnShift
+ ifTrue: [Sensor shiftPressed ifTrue: [
+ self changed: #contentsSelection.
+ self updateInspectors.
+ ^self]]
+ ifFalse: [Sensor shiftPressed ifFalse: [breakOnShift := true]].
+ lastUpdate := Time millisecondClockValue] ]].
+
+ self contextStackIndex > 1
+ ifTrue: [self resetContext: newContext]
+ ifFalse:
+ [newContext == currentContext
+ ifTrue: [self changed: #contentsSelection; updateInspectors]
+ ifFalse: [self resetContext: newContext]].
+
+ ^ value
+ !

Item was changed:
  ----- Method: Debugger>>runToSelection: (in category 'code pane menu') -----
  runToSelection: selectionInterval
+
- | currentContext |
  self pc first >= selectionInterval first ifTrue: [ ^self ].
+ self doStepUntil: [ self pc first >= selectionInterval first ].!
- currentContext := self selectedContext.
- [ currentContext == self selectedContext and: [ self pc first < selectionInterval first ] ] whileTrue: [ self doStep ].!

Item was changed:
  ----- Method: Debugger>>runUntil (in category 'code pane menu') -----
  runUntil
+ "Step until an expression evaluates to other than false, reporting an error if it doesn't evaluate to true. Remember the expression in an inst var."
+
+ | expression receiver context method value |
- "Step until an expression evaluates to other than false, reporting an error if it doesn't evaluate to true.
- Remember the expression in an inst var.  If shift is pressed when the expression is supplied, don't update the UI.
- If shift is pressed while stepping, stop stepping.  Using a user interrupt to break out would be more natural
- but Squeak currently doesn't provide a UserInterrupt expection.  It should do."
- | expression receiver context method value lastUpdate updateUI breakOnShift |
  expression := UIManager default
  request: 'run until expression is true (shift to disable ui update; shift to break).'
  initialAnswer: (untilExpression ifNil: 'boolean expression').
  (expression isNil or: [expression isEmpty]) ifTrue:
  [^self].
- updateUI := breakOnShift := Sensor shiftPressed not.
  untilExpression := expression.
  context := self selectedContext.
  receiver := context receiver.
  method := receiver class evaluatorClass new
  compiledMethodFor: untilExpression
  in: context
  to: receiver
  notifying: nil
  ifFail: [^ #failedDoit].
 
+ value := self doStepUntil: [method valueWithReceiver: receiver arguments: {context}].
+
- lastUpdate := Time millisecondClockValue.
- Cursor execute showWhile:
- [[self selectedContext == context
-  and: [context willReturn not
-  and: [(value := method valueWithReceiver: receiver arguments: {context}) == false]]] whileTrue:
- [interruptedProcess completeStep: self selectedContext.
- self selectedContext == context ifTrue:
- [self resetContext: interruptedProcess stepToSendOrReturn changeContents: false].
- Time millisecondClockValue - lastUpdate > 50 ifTrue:
- [updateUI ifTrue:
- [self changed: #contentsSelection.
- Project current world displayWorldSafely].
- breakOnShift
- ifTrue: [Sensor shiftPressed ifTrue:
- [self changed: #contentsSelection.
- self updateInspectors.
- ^self]]
- ifFalse: [Sensor shiftPressed ifFalse: [breakOnShift := true]].
- lastUpdate := Time millisecondClockValue]]].
- self changed: #contentsSelection.
- self updateInspectors.
  (value ~~ false and: [value ~~ true]) ifTrue:
  [UIManager default inform: 'expression ', (untilExpression contractTo: 40), ' answered ', (value printString contractTo: 20), '!!!!']!