The Trunk: Tools-eem.1016.mcz

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

The Trunk: Tools-eem.1016.mcz

commits-2
Eliot Miranda uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-eem.1016.mcz

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

Name: Tools-eem.1016
Author: eem
Time: 13 November 2020, 9:11:29.559774 pm
UUID: 2bb4d3c0-32cd-49c7-b9c5-f04bed33c416
Ancestors: Tools-mt.1015

Have the ProcessBrowser maintain a stackDepth variable and allow moreStack to grow it by a factor of two (we can add lessStack too).  fullStack can be dangerous for very deep stacks.

Also allow the ProcessBrowser to suspend the UI propcess, spawning a new one if it does so.  being able to suspend the UI process is a very useful facility I need right now in debugging the multi-threaded VM.

=============== Diff against Tools-mt.1015 ===============

Item was changed:
  Model subclass: #ProcessBrowser
+ instanceVariableNames: 'selectedProcess selectedContext methodText processList processListIndex stackList stackListIndex stackDepth sourceMap selectedClass selectedSelector searchString autoUpdateProcess lastUpdate startedCPUWatcher'
- instanceVariableNames: 'selectedProcess selectedContext methodText processList processListIndex stackList stackListIndex sourceMap selectedClass selectedSelector searchString autoUpdateProcess lastUpdate startedCPUWatcher'
  classVariableNames: 'Browsers SuspendedProcesses WellKnownProcesses'
  poolDictionaries: ''
  category: 'Tools-Process Browser'!
 
  !ProcessBrowser commentStamp: '<historical>' prior: 0!
  Change Set: ProcessBrowser
  Date: 14 March 2000
  Author: Ned Konz
 
  email: [hidden email]
 
  This is distributed under the Squeak License.
 
  Added 14 March:
  CPUWatcher integration
  automatically start and stop CPUWatcher
  added CPUWatcher to process list menu
 
  Added 29 October:
  MVC version
  2.8, 2.7 compatibility
  rearranged menus
  added pointer inspection and chasing
  added suspend/resume
  recognized more well-known processes
  misc. bug fixes
 
  Added 26 October: highlight pc in source code
  Added 27 October: added 'signal semaphore'
  added 'inspect receiver', 'explore receiver', 'message tally' to stack list menu
  added 'find context', 'next context' to process list menu
  added 'change priority' and 'debug' choices to process list menu
 
  27 October mods by Bob Arning:
 
  alters process display in Ned's ProcessBrowser to
  - show process priority
  - drop 'a Process in' that appears on each line
  - show in priority order
  - prettier names for known processes
  - fix to Utilities to forget update downloading process when it ends (1 less dead
  process)
  - correct stack dump for the active process
  !

Item was changed:
  ----- Method: ProcessBrowser class>>registerWellKnownProcesses (in category 'class initialization') -----
  registerWellKnownProcesses
  "Associate each well-known process with a nickname and two flags: allow-stop, and allow-debug.
  Additional processes may be added to this list as required"
 
  WellKnownProcesses := OrderedCollection new.
  self registerWellKnownProcess: []
  label: 'no process'
  allowStop: false
  allowDebug: false.
  self registerWellKnownProcess: [Smalltalk lowSpaceWatcherProcess]
  label: 'the low space watcher'
  allowStop: false
  allowDebug: false.
  self registerWellKnownProcess: [WeakArray runningFinalizationProcess]
  label: 'the WeakArray finalization process'
  allowStop: false
  allowDebug: false.
  self registerWellKnownProcess: [Processor activeProcess]
  label: 'the UI process'
+ allowStop: true
- allowStop: false
  allowDebug: true.
  self registerWellKnownProcess: [Processor backgroundProcess]
  label: 'the idle process'
  allowStop: false
  allowDebug: false.
  self registerWellKnownProcess: [Sensor interruptWatcherProcess]
  label: 'the user interrupt watcher'
  allowStop: false
  allowDebug: false.
  self registerWellKnownProcess: [Sensor eventTicklerProcess]
  label: 'the event tickler'
  allowStop: false
  allowDebug: false.
  self registerWellKnownProcess: [Project uiProcess]
  label: 'the inactive Morphic UI process'
+ allowStop: true
- allowStop: false
  allowDebug: false.
  " self registerWellKnownProcess:
  [Smalltalk at: #SoundPlayer ifPresent: [:sp | sp playerProcess]]
  label: 'the Sound Player'
  allowStop: false
  allowDebug: false."
  self registerWellKnownProcess:
  [ScheduledControllers ifNotNil: [ScheduledControllers activeControllerProcess]]
  label: 'the inactive MVC controller process'
  allowStop: false
  allowDebug: true.
  self registerWellKnownProcess:
  [Smalltalk at: #CPUWatcher ifPresent: [:cw | cw currentWatcherProcess]]
  label: 'the CPUWatcher'
  allowStop: false
  allowDebug: false
  !

Item was added:
+ ----- Method: ProcessBrowser>>fullStack (in category 'stack list') -----
+ fullStack
+ stackDepth := SmallInteger maxVal.
+ self updateStackList!

Item was changed:
  ----- Method: ProcessBrowser>>initialize (in category 'initialize-release') -----
  initialize
+ methodText := ''..
+ stackDepth := 20.
- methodText := ''.
  stackListIndex := 0.
  searchString := ''.
  lastUpdate := 0.
  startedCPUWatcher := CPUWatcher cpuWatcherEnabled and: [ self startCPUWatcher ].
  self updateProcessList; processListIndex: 1.
  Browsers add: self!

Item was changed:
  ----- Method: ProcessBrowser>>moreStack (in category 'stack list') -----
  moreStack
+ stackDepth := stackDepth + stackDepth.
+ self updateStackList!
- self updateStackList: 2000!

Item was changed:
  ----- Method: ProcessBrowser>>processListKey:from: (in category 'process list') -----
  processListKey: aKey from: aView
 
  aKey
  caseOf: {
  [$f] -> [^ self findContext].
  [$g] -> [^ self nextContext].
  [$a] -> [^ self toggleAutoUpdate].
  [$u] -> [^ self updateProcessList] }
  otherwise: [].
  selectedProcess ifNil: [^ self changed: #flash].
  ^ aKey
  caseOf: {
  [$i] -> [self inspectProcess].
  [$I] -> [self exploreProcess].
  [$c] -> [self chasePointers].
  [$P] -> [self inspectPointers].
  [$t] -> [self terminateProcess].
  [$r] -> [self resumeProcess].
  [$s] -> [self suspendProcess].
  [$d] -> [self debugProcess].
  [$p] -> [self changePriority].
  [$m] -> [self messageTally].
  [$S] -> [self signalSemaphore].
+ [$k] -> [self fullStack]}
- [$k] -> [self moreStack]}
  otherwise: [self arrowKey: aKey from: aView]!

Item was changed:
  ----- Method: ProcessBrowser>>processListMenu: (in category 'process list') -----
  processListMenu: menu
 
  selectedProcess ifNotNil:
  [:process|
  [:name :allowStop :allowDebug|
  menu addList: #(('inspect (i)' inspectProcess) ('explore (I)' exploreProcess) ('inspect Pointers (P)' inspectPointers)).
  (Smalltalk includesKey: #PointerFinder) ifTrue:
  [menu add: 'chase pointers (c)' action: #chasePointers].
  allowStop ifTrue:
  [menu add: 'terminate (t)' action: #terminateProcess.
  process isSuspended
  ifTrue: [menu add: 'resume (r)' action: #resumeProcess]
  ifFalse: [menu add: 'suspend (s)' action: #suspendProcess]].
  allowDebug ifTrue:
  [menu addList: #(('change priority (p)' changePriority) ('debug (d)' debugProcess))].
  menu add: 'profile messages (m)' action: #messageTally.
  (process suspendingList isKindOf: Semaphore) ifTrue:
  [menu add: 'signal Semaphore (S)' action: #signalSemaphore].
+ menu addList: #(('full stack (k)' fullStack) ('copy stack to clipboard' copyProcessStackToClipboard)).
- menu addList: #(('full stack (k)' moreStack) ('copy stack to clipboard' copyProcessStackToClipboard)).
  menu addLine] valueWithArguments: (self nameAndRulesFor: process)].
 
  menu
  addList: #(#('find context... (f)' findContext) #('find again (g)' nextContext));
  addLine;
  add: (self isAutoUpdating
  ifTrue: ['turn off auto-update (a)']
  ifFalse: ['turn on auto-update (a)'])
  action: #toggleAutoUpdate;
  add: 'update list (u)' action: #updateProcessList.
 
  (Smalltalk at: #CPUWatcher ifAbsent: []) ifNotNil:
  [:pw|
  menu addLine.
  pw isMonitoring
  ifTrue: [menu add: 'stop CPUWatcher' action: #stopCPUWatcher]
  ifFalse: [menu add: 'start CPUWatcher' action: #startCPUWatcher]].
 
  ^menu!

Item was changed:
  ----- Method: ProcessBrowser>>stackListMenu: (in category 'stack list') -----
  stackListMenu: aMenu
+ selectedContext ifNil: [^aMenu].
+ ^aMenu
- | menu |
- selectedContext
- ifNil: [^ aMenu].
- menu := aMenu
  labels: 'inspect context (c)
  explore context (C)
  inspect receiver (i)
  explore receiver (I)
+ browse (b)
+ more stack'
+ lines: #(2 4 5)
+ selections: #(#inspectContext #exploreContext #inspectReceiver #exploreReceiver #browseContext moreStack)!
- browse (b)'
- lines: #(2 4 )
- selections: #(#inspectContext #exploreContext #inspectReceiver #exploreReceiver #browseContext ).
- ^ menu!

Item was changed:
  ----- Method: ProcessBrowser>>suspendProcess (in category 'process actions') -----
  suspendProcess
  | nameAndRules |
+ selectedProcess isSuspended ifTrue:
+ [^self].
- selectedProcess isSuspended
- ifTrue: [^ self].
  nameAndRules := self nameAndRulesForSelectedProcess.
+ nameAndRules second ifFalse:
+ [self inform: 'Nope, won''t suspend ' , nameAndRules first.
+ ^self].
+ selectedProcess == Project current uiProcess ifTrue:
+ [Project current spawnNewProcessIfThisIsUI: selectedProcess.
+ WorldState addDeferredUIMessage: [self updateProcessList]].
- nameAndRules second
- ifFalse: [self inform: 'Nope, won''t suspend ' , nameAndRules first.
- ^ self].
  self class suspendProcess: selectedProcess.
  self updateProcessList!

Item was changed:
  ----- Method: ProcessBrowser>>updateStackList (in category 'stack list') -----
  updateStackList
+ self updateStackList: stackDepth!
- self updateStackList: 20!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-eem.1016.mcz

marcel.taeumel
Also allow the ProcessBrowser to suspend the UI propcess, spawning a new one if it does so.

Yes! Thanks :-)

Best,
Marcel

Am 14.11.2020 06:11:49 schrieb [hidden email] <[hidden email]>:

Eliot Miranda uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-eem.1016.mcz

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

Name: Tools-eem.1016
Author: eem
Time: 13 November 2020, 9:11:29.559774 pm
UUID: 2bb4d3c0-32cd-49c7-b9c5-f04bed33c416
Ancestors: Tools-mt.1015

Have the ProcessBrowser maintain a stackDepth variable and allow moreStack to grow it by a factor of two (we can add lessStack too). fullStack can be dangerous for very deep stacks.

Also allow the ProcessBrowser to suspend the UI propcess, spawning a new one if it does so. being able to suspend the UI process is a very useful facility I need right now in debugging the multi-threaded VM.

=============== Diff against Tools-mt.1015 ===============

Item was changed:
Model subclass: #ProcessBrowser
+ instanceVariableNames: 'selectedProcess selectedContext methodText processList processListIndex stackList stackListIndex stackDepth sourceMap selectedClass selectedSelector searchString autoUpdateProcess lastUpdate startedCPUWatcher'
- instanceVariableNames: 'selectedProcess selectedContext methodText processList processListIndex stackList stackListIndex sourceMap selectedClass selectedSelector searchString autoUpdateProcess lastUpdate startedCPUWatcher'
classVariableNames: 'Browsers SuspendedProcesses WellKnownProcesses'
poolDictionaries: ''
category: 'Tools-Process Browser'!

!ProcessBrowser commentStamp: '' prior: 0!
Change Set: ProcessBrowser
Date: 14 March 2000
Author: Ned Konz

email: [hidden email]

This is distributed under the Squeak License.

Added 14 March:
CPUWatcher integration
automatically start and stop CPUWatcher
added CPUWatcher to process list menu

Added 29 October:
MVC version
2.8, 2.7 compatibility
rearranged menus
added pointer inspection and chasing
added suspend/resume
recognized more well-known processes
misc. bug fixes

Added 26 October: highlight pc in source code
Added 27 October: added 'signal semaphore'
added 'inspect receiver', 'explore receiver', 'message tally' to stack list menu
added 'find context', 'next context' to process list menu
added 'change priority' and 'debug' choices to process list menu

27 October mods by Bob Arning:

alters process display in Ned's ProcessBrowser to
- show process priority
- drop 'a Process in' that appears on each line
- show in priority order
- prettier names for known processes
- fix to Utilities to forget update downloading process when it ends (1 less dead
process)
- correct stack dump for the active process
!

Item was changed:
----- Method: ProcessBrowser class>>registerWellKnownProcesses (in category 'class initialization') -----
registerWellKnownProcesses
"Associate each well-known process with a nickname and two flags: allow-stop, and allow-debug.
Additional processes may be added to this list as required"

WellKnownProcesses := OrderedCollection new.
self registerWellKnownProcess: []
label: 'no process'
allowStop: false
allowDebug: false.
self registerWellKnownProcess: [Smalltalk lowSpaceWatcherProcess]
label: 'the low space watcher'
allowStop: false
allowDebug: false.
self registerWellKnownProcess: [WeakArray runningFinalizationProcess]
label: 'the WeakArray finalization process'
allowStop: false
allowDebug: false.
self registerWellKnownProcess: [Processor activeProcess]
label: 'the UI process'
+ allowStop: true
- allowStop: false
allowDebug: true.
self registerWellKnownProcess: [Processor backgroundProcess]
label: 'the idle process'
allowStop: false
allowDebug: false.
self registerWellKnownProcess: [Sensor interruptWatcherProcess]
label: 'the user interrupt watcher'
allowStop: false
allowDebug: false.
self registerWellKnownProcess: [Sensor eventTicklerProcess]
label: 'the event tickler'
allowStop: false
allowDebug: false.
self registerWellKnownProcess: [Project uiProcess]
label: 'the inactive Morphic UI process'
+ allowStop: true
- allowStop: false
allowDebug: false.
" self registerWellKnownProcess:
[Smalltalk at: #SoundPlayer ifPresent: [:sp | sp playerProcess]]
label: 'the Sound Player'
allowStop: false
allowDebug: false."
self registerWellKnownProcess:
[ScheduledControllers ifNotNil: [ScheduledControllers activeControllerProcess]]
label: 'the inactive MVC controller process'
allowStop: false
allowDebug: true.
self registerWellKnownProcess:
[Smalltalk at: #CPUWatcher ifPresent: [:cw | cw currentWatcherProcess]]
label: 'the CPUWatcher'
allowStop: false
allowDebug: false
!

Item was added:
+ ----- Method: ProcessBrowser>>fullStack (in category 'stack list') -----
+ fullStack
+ stackDepth := SmallInteger maxVal.
+ self updateStackList!

Item was changed:
----- Method: ProcessBrowser>>initialize (in category 'initialize-release') -----
initialize
+ methodText := ''..
+ stackDepth := 20.
- methodText := ''.
stackListIndex := 0.
searchString := ''.
lastUpdate := 0.
startedCPUWatcher := CPUWatcher cpuWatcherEnabled and: [ self startCPUWatcher ].
self updateProcessList; processListIndex: 1.
Browsers add: self!

Item was changed:
----- Method: ProcessBrowser>>moreStack (in category 'stack list') -----
moreStack
+ stackDepth := stackDepth + stackDepth.
+ self updateStackList!
- self updateStackList: 2000!

Item was changed:
----- Method: ProcessBrowser>>processListKey:from: (in category 'process list') -----
processListKey: aKey from: aView

aKey
caseOf: {
[$f] -> [^ self findContext].
[$g] -> [^ self nextContext].
[$a] -> [^ self toggleAutoUpdate].
[$u] -> [^ self updateProcessList] }
otherwise: [].
selectedProcess ifNil: [^ self changed: #flash].
^ aKey
caseOf: {
[$i] -> [self inspectProcess].
[$I] -> [self exploreProcess].
[$c] -> [self chasePointers].
[$P] -> [self inspectPointers].
[$t] -> [self terminateProcess].
[$r] -> [self resumeProcess].
[$s] -> [self suspendProcess].
[$d] -> [self debugProcess].
[$p] -> [self changePriority].
[$m] -> [self messageTally].
[$S] -> [self signalSemaphore].
+ [$k] -> [self fullStack]}
- [$k] -> [self moreStack]}
otherwise: [self arrowKey: aKey from: aView]!

Item was changed:
----- Method: ProcessBrowser>>processListMenu: (in category 'process list') -----
processListMenu: menu

selectedProcess ifNotNil:
[:process|
[:name :allowStop :allowDebug|
menu addList: #(('inspect (i)' inspectProcess) ('explore (I)' exploreProcess) ('inspect Pointers (P)' inspectPointers)).
(Smalltalk includesKey: #PointerFinder) ifTrue:
[menu add: 'chase pointers (c)' action: #chasePointers].
allowStop ifTrue:
[menu add: 'terminate (t)' action: #terminateProcess.
process isSuspended
ifTrue: [menu add: 'resume (r)' action: #resumeProcess]
ifFalse: [menu add: 'suspend (s)' action: #suspendProcess]].
allowDebug ifTrue:
[menu addList: #(('change priority (p)' changePriority) ('debug (d)' debugProcess))].
menu add: 'profile messages (m)' action: #messageTally.
(process suspendingList isKindOf: Semaphore) ifTrue:
[menu add: 'signal Semaphore (S)' action: #signalSemaphore].
+ menu addList: #(('full stack (k)' fullStack) ('copy stack to clipboard' copyProcessStackToClipboard)).
- menu addList: #(('full stack (k)' moreStack) ('copy stack to clipboard' copyProcessStackToClipboard)).
menu addLine] valueWithArguments: (self nameAndRulesFor: process)].

menu
addList: #(#('find context... (f)' findContext) #('find again (g)' nextContext));
addLine;
add: (self isAutoUpdating
ifTrue: ['turn off auto-update (a)']
ifFalse: ['turn on auto-update (a)'])
action: #toggleAutoUpdate;
add: 'update list (u)' action: #updateProcessList.

(Smalltalk at: #CPUWatcher ifAbsent: []) ifNotNil:
[:pw|
menu addLine.
pw isMonitoring
ifTrue: [menu add: 'stop CPUWatcher' action: #stopCPUWatcher]
ifFalse: [menu add: 'start CPUWatcher' action: #startCPUWatcher]].

^menu!

Item was changed:
----- Method: ProcessBrowser>>stackListMenu: (in category 'stack list') -----
stackListMenu: aMenu
+ selectedContext ifNil: [^aMenu].
+ ^aMenu
- | menu |
- selectedContext
- ifNil: [^ aMenu].
- menu := aMenu
labels: 'inspect context (c)
explore context (C)
inspect receiver (i)
explore receiver (I)
+ browse (b)
+ more stack'
+ lines: #(2 4 5)
+ selections: #(#inspectContext #exploreContext #inspectReceiver #exploreReceiver #browseContext moreStack)!
- browse (b)'
- lines: #(2 4 )
- selections: #(#inspectContext #exploreContext #inspectReceiver #exploreReceiver #browseContext ).
- ^ menu!

Item was changed:
----- Method: ProcessBrowser>>suspendProcess (in category 'process actions') -----
suspendProcess
| nameAndRules |
+ selectedProcess isSuspended ifTrue:
+ [^self].
- selectedProcess isSuspended
- ifTrue: [^ self].
nameAndRules := self nameAndRulesForSelectedProcess.
+ nameAndRules second ifFalse:
+ [self inform: 'Nope, won''t suspend ' , nameAndRules first.
+ ^self].
+ selectedProcess == Project current uiProcess ifTrue:
+ [Project current spawnNewProcessIfThisIsUI: selectedProcess.
+ WorldState addDeferredUIMessage: [self updateProcessList]].
- nameAndRules second
- ifFalse: [self inform: 'Nope, won''t suspend ' , nameAndRules first.
- ^ self].
self class suspendProcess: selectedProcess.
self updateProcessList!

Item was changed:
----- Method: ProcessBrowser>>updateStackList (in category 'stack list') -----
updateStackList
+ self updateStackList: stackDepth!
- self updateStackList: 20!