[squeak-dev] Re: MVC debugging
David T. Lewis
lewis at mail.msen.com
Wed Sep 8 10:46:51 UTC 2010
Florin, Andreas,
Great thanks for this progress! I do get a debugger window now (yay!).
I'm just heading out the door for the day but look forward to playing
with this later.
Dave
On Wed, Sep 08, 2010 at 02:49:21AM -0400, Florin Mateoc wrote:
> On 9/8/2010 1:54 AM, Andreas Raab wrote:
> > On 9/7/2010 7:57 PM, David T. Lewis wrote:
> >> I can't reproduce this. Are you able to get a debugger to open under
> >> MVC at this point?
> >
> > Yes. I would have posted this earlier but I had an unexpected dinner and don't feel quite capable of doing this now
> > (hick!).
> >
> >> Specifically, I changed Debugger class>>openOn:context:label:contents:fullView:
> >> to call #searchForActiveControllerNoTerminate, where #searchForActiveControllerNoTerminate
> >> is a copy of #searchForActiveController with the #terminateActive removed.
> >> I'm not seeing any difference in behavior, so I must be missing a step
> >> in the recipe.
> >
> > All right, I'm attaching the changes I have so far unreviewed. With these changes I've been able to debug just fine
> > except from the case of handling a user interrupt which doesn't quite work yet. If you want to try this out, give it a
> > shot, if not, I'll try to make headway tomorrow night. Right now I need some sleep :-)
> >
> > Cheers,
> > - Andreas
> >
> >
> >
>
> I also did a little debugging, and I now think that the two main issues are:
> 1 the code to open the debugger is inside WorldState addDeferredUiMessage: [], even for MVC, which will probably never
> get executed
> 2 MVCTooBuilder was supposed to openNoTerminate (not open, which terminates the previous UI process) when called from
> the debugger code
>
> With these two addressed, I get the debugger as well (but also not from the user interrupt) - these are as hacks only (I
> named the openNoTerminate methods in the ToolBuilders 'open1'), but I post them as part of the conversation.
> I am not sure if these changes are identical to Andreas', but I also have to go to bed now :)
>
> Florin
>
>
>
> 'From Squeak4.1 of 17 April 2010 [latest update: #9957] on 8 September 2010 at 2:34:52 am'!
>
> !Debugger methodsFor: 'initialize' stamp: 'fm 9/8/2010 01:42'!
> openFullNoSuspendLabel: aString
> "Create and schedule a full debugger with the given label. Do not terminate the current active process."
>
> | oldContextStackIndex |
> oldContextStackIndex := contextStackIndex.
> self expandStack. "Sets contextStackIndex to zero."
> ToolBuilder open1: self label: aString.
> self toggleContextStackIndex: oldContextStackIndex.! !
>
> !Debugger methodsFor: 'initialize' stamp: 'fm 9/8/2010 01:39'!
> openNotifierContents: msgString label: label
> "Create and schedule a notifier view with the given label and message. A notifier view shows just the message or the
> first several lines of the stack, with a menu that allows the user to open a full debugger if so desired."
> "NOTE: When this method returns, a new process has been scheduled to run the windows, and thus this notifier, but
> the previous active porcess has not been suspended. The sender will do this."
> | msg builder spec |
> Sensor flushKeyboard.
> savedCursor := Sensor currentCursor.
> Sensor currentCursor: Cursor normal.
> (label beginsWith: 'Space is low')
> ifTrue: [msg := self lowSpaceChoices, (msgString ifNil: [''])]
> ifFalse: [msg := msgString].
> builder := ToolBuilder default.
> spec := self buildNotifierWith: builder label: label message: msg.
> self expandStack.
> builder open1: spec.
> errorWasInUIProcess := Project spawnNewProcessIfThisIsUI: interruptedProcess.
> ! !
>
>
> !Debugger class methodsFor: 'opening' stamp: 'fm 9/8/2010 02:02'!
> openOn: process context: context label: title contents: contentsStringOrNil fullView: bool
> "Open a notifier in response to an error, halt, or notify. A notifier view just shows a short view of the sender
> stack and provides a menu that lets the user open a full debugger."
>
> | controller errorWasInUIProcess debugger |
> Smalltalk isMorphic
> ifTrue: [errorWasInUIProcess := Project spawnNewProcessIfThisIsUI: process]
> ifFalse: [controller := ScheduledControllers activeControllerProcess == process
> ifTrue: [ScheduledControllers activeController].
> debugger := self new process: process controller: controller context: context.
> bool
> ifTrue: [debugger openFullNoSuspendLabel: title]
> ifFalse: [debugger openNotifierContents: contentsStringOrNil label: title]].
> WorldState addDeferredUIMessage: [
> [
> debugger := self new process: process controller: controller context: context.
> Smalltalk isMorphic
> ifTrue: ["schedule debugger in deferred UI message to address redraw
> problems after opening a debugger e.g. from the testrunner."
> "WorldState addDeferredUIMessage: "
> bool
> ifTrue: [debugger openFullNoSuspendLabel: title]
> ifFalse: [debugger openNotifierContents: contentsStringOrNil label: title]]
> ifFalse: ["deferred UI message would require special controller in MVC"
> bool
> ifTrue: [debugger openFullNoSuspendLabel: title]
> ifFalse: [debugger openNotifierContents: contentsStringOrNil label: title]].
> debugger errorWasInUIProcess: errorWasInUIProcess.
> Preferences logDebuggerStackToFile ifTrue: [
> Smalltalk logError: title inContext: context to: 'SqueakDebug.log'].
> Smalltalk isMorphic
> ifFalse: [ScheduledControllers searchForActiveController "needed since openNoTerminate (see debugger
> #open...) does not set up activeControllerProcess if activeProcess (this fork) is not the current
> activeControllerProcess (see #scheduled:from:)"].
> ] on: Error do: [:ex |
> self primitiveError:
> 'Orginal error: ',
> title asString, '.
> Debugger error: ',
> ([ex description] on: Error do: ['a ', ex class printString]), ':'
> ]
> ].
> process suspend.
> ! !
>
>
> !MVCToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:39'!
> open1: anObject
> "Build and open the object. Answer the widget opened."
> | window |
> window := self build: anObject.
> window controller openNoTerminate.
> ^window! !
>
> !MVCToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:41'!
> open1: anObject label: aString
> "Build an open the object, labeling it appropriately. Answer the widget opened."
> | window |
> window := self build: anObject.
> window label: aString.
> window controller openNoTerminate.
> ^window! !
>
> !MVCToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:22'!
> open: anObject
> "Build and open the object. Answer the widget opened."
> | window |
> window := self build: anObject.
> window controller open.
> ^window! !
>
> !MVCToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:23'!
> open: anObject label: aString
> "Build an open the object, labeling it appropriately. Answer the widget opened."
> | window |
> window := self build: anObject.
> window label: aString.
> window controller open.
> ^window! !
>
>
> !MorphicToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:39'!
> open1: anObject
> "Build and open the object. Answer the widget opened."
> | morph |
> anObject isMorph
> ifTrue:[morph := anObject]
> ifFalse:[morph := self build: anObject].
> (morph isKindOf: MenuMorph)
> ifTrue:[morph popUpInWorld: World].
> (morph isKindOf: SystemWindow)
> ifTrue:[morph openInWorldExtent: morph extent]
> ifFalse:[morph openInWorld].
> ^morph! !
>
> !MorphicToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:41'!
> open1: anObject label: aString
> "Build an open the object, labeling it appropriately. Answer the widget opened."
> | window |
> window := self open: anObject.
> window setLabel: aString.
> ^window! !
>
>
> !ToolBuilder class methodsFor: 'accessing' stamp: 'fm 9/8/2010 02:28'!
> default: aToolBuilder
> "Set a new default tool builder"
> aToolBuilder isNil ifTrue: [Processor activeProcess debug].
> Default := aToolBuilder.! !
>
> !ToolBuilder class methodsFor: 'instance creation' stamp: 'fm 9/8/2010 02:10'!
> open1: aClass label: aString
> ^self default open1: aClass label: aString! !
>
>
>
More information about the Squeak-dev
mailing list
|