<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 9/8/2010 1:54 AM, Andreas Raab wrote:
    <blockquote cite="mid:4C8724FC.6070705@gmx.de" type="cite">On
      9/7/2010 7:57 PM, David T. Lewis wrote:
      <br>
      <blockquote type="cite">I can't reproduce this. Are you able to
        get a debugger to open under
        <br>
        MVC at this point?
        <br>
      </blockquote>
      <br>
      Yes. I would have posted this earlier but I had an unexpected
      dinner and don't feel quite capable of doing this now (hick!).
      <br>
      <br>
      <blockquote type="cite">Specifically, I changed Debugger
        class&gt;&gt;openOn:context:label:contents:fullView:
        <br>
        to call #searchForActiveControllerNoTerminate, where
        #searchForActiveControllerNoTerminate
        <br>
        is a copy of #searchForActiveController with the
        #terminateActive removed.
        <br>
        I'm not seeing any difference in behavior, so I must be missing
        a step
        <br>
        in the recipe.
        <br>
      </blockquote>
      <br>
      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 :-)
      <br>
      <br>
      Cheers,
      <br>
      &nbsp; - Andreas
      <br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>

</pre>
    </blockquote>
    <br>
    I also did a little debugging, and I now think that the two main
    issues are:<br>
    1 the code to open the debugger is inside WorldState
    addDeferredUiMessage: [], even for MVC, which will probably never
    get executed<br>
    2 MVCTooBuilder was supposed to openNoTerminate (not open, which
    terminates the previous UI process) when called from the debugger
    code<br>
    <br>
    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.<br>
    I am not sure if these changes are identical to Andreas', but I also
    have to go to bed now :)<br>
    <br>
    Florin<br>
    <br>
    <br>
    <br>
    'From Squeak4.1 of 17 April 2010 [latest update: #9957] on 8
    September 2010 at 2:34:52 am'!<br>
    <br>
    !Debugger methodsFor: 'initialize' stamp: 'fm 9/8/2010 01:42'!<br>
    openFullNoSuspendLabel: aString<br>
    &nbsp;&nbsp;&nbsp; "Create and schedule a full debugger with the given label. Do
    not terminate the current active process."<br>
    <br>
    &nbsp;&nbsp;&nbsp; | oldContextStackIndex |<br>
    &nbsp;&nbsp;&nbsp; oldContextStackIndex := contextStackIndex.<br>
    &nbsp;&nbsp;&nbsp; self expandStack. "Sets contextStackIndex to zero."<br>
    &nbsp;&nbsp;&nbsp; ToolBuilder open1: self label: aString.<br>
    &nbsp;&nbsp;&nbsp; self toggleContextStackIndex: oldContextStackIndex.! !<br>
    <br>
    !Debugger methodsFor: 'initialize' stamp: 'fm 9/8/2010 01:39'!<br>
    openNotifierContents: msgString label: label<br>
    &nbsp;&nbsp;&nbsp; "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."<br>
    &nbsp;&nbsp;&nbsp; "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.&nbsp; The sender will do
    this."<br>
    &nbsp;&nbsp;&nbsp; | msg builder spec |<br>
    &nbsp;&nbsp;&nbsp; Sensor flushKeyboard.<br>
    &nbsp;&nbsp;&nbsp; savedCursor := Sensor currentCursor.<br>
    &nbsp;&nbsp;&nbsp; Sensor currentCursor: Cursor normal.<br>
    &nbsp;&nbsp;&nbsp; (label beginsWith: 'Space is low')<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue: [msg := self lowSpaceChoices, (msgString ifNil:
    [''])]<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse: [msg := msgString].<br>
    &nbsp;&nbsp;&nbsp; builder := ToolBuilder default.<br>
    &nbsp;&nbsp;&nbsp; spec := self buildNotifierWith: builder label: label message:
    msg.<br>
    &nbsp;&nbsp;&nbsp; self expandStack.<br>
    &nbsp;&nbsp;&nbsp; builder open1: spec.<br>
    &nbsp;&nbsp;&nbsp; errorWasInUIProcess := Project spawnNewProcessIfThisIsUI:
    interruptedProcess.<br>
    ! !<br>
    <br>
    <br>
    !Debugger class methodsFor: 'opening' stamp: 'fm 9/8/2010 02:02'!<br>
    openOn: process context: context label: title contents:
    contentsStringOrNil fullView: bool<br>
    &nbsp;&nbsp;&nbsp; "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."<br>
    <br>
    &nbsp;&nbsp;&nbsp; | controller errorWasInUIProcess debugger |<br>
    &nbsp;&nbsp;&nbsp; Smalltalk isMorphic<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue: [errorWasInUIProcess := Project
    spawnNewProcessIfThisIsUI: process]<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse: [controller := ScheduledControllers
    activeControllerProcess == process<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue: [ScheduledControllers activeController].<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; debugger := self new process: process controller:
    controller context: context.<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bool<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue: [debugger openFullNoSuspendLabel:
    title]<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse: [debugger openNotifierContents:
    contentsStringOrNil label: title]].<br>
    &nbsp;&nbsp;&nbsp; WorldState addDeferredUIMessage: [ <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; debugger := self new process: process controller:
    controller context: context.<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Smalltalk isMorphic<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue: ["schedule debugger in deferred UI message
    to address redraw<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; problems after opening a debugger e.g. from
    the testrunner."<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; "WorldState addDeferredUIMessage: "<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bool<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue: [debugger openFullNoSuspendLabel:
    title]<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse: [debugger openNotifierContents:
    contentsStringOrNil label: title]]<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse: ["deferred UI message would require special
    controller in MVC"<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bool<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue: [debugger openFullNoSuspendLabel:
    title]<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse: [debugger openNotifierContents:
    contentsStringOrNil label: title]].<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; debugger errorWasInUIProcess: errorWasInUIProcess.<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Preferences logDebuggerStackToFile ifTrue: [<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Smalltalk logError: title inContext: context to:
    'SqueakDebug.log'].<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Smalltalk isMorphic<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 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:)"].<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ] on: Error do: [:ex |<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self primitiveError: <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'Orginal error: ', <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; title asString, '.<br>
    &nbsp;&nbsp;&nbsp; Debugger error: ', <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ([ex description] on: Error do: ['a ', ex class
    printString]), ':'<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ]<br>
    &nbsp;&nbsp;&nbsp; ].<br>
    &nbsp;&nbsp;&nbsp; process suspend.<br>
    ! !<br>
    <br>
    <br>
    !MVCToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:39'!<br>
    open1: anObject<br>
    &nbsp;&nbsp;&nbsp; "Build and open the object. Answer the widget opened."<br>
    &nbsp;&nbsp;&nbsp; | window |<br>
    &nbsp;&nbsp;&nbsp; window := self build: anObject.<br>
    &nbsp;&nbsp;&nbsp; window controller openNoTerminate.<br>
    &nbsp;&nbsp;&nbsp; ^window! !<br>
    <br>
    !MVCToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:41'!<br>
    open1: anObject label: aString<br>
    &nbsp;&nbsp;&nbsp; "Build an open the object, labeling it appropriately.&nbsp; Answer
    the widget opened."<br>
    &nbsp;&nbsp;&nbsp; | window |<br>
    &nbsp;&nbsp;&nbsp; window := self build: anObject.<br>
    &nbsp;&nbsp;&nbsp; window label: aString.<br>
    &nbsp;&nbsp;&nbsp; window controller openNoTerminate.<br>
    &nbsp;&nbsp;&nbsp; ^window! !<br>
    <br>
    !MVCToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:22'!<br>
    open: anObject<br>
    &nbsp;&nbsp;&nbsp; "Build and open the object. Answer the widget opened."<br>
    &nbsp;&nbsp;&nbsp; | window |<br>
    &nbsp;&nbsp;&nbsp; window := self build: anObject.<br>
    &nbsp;&nbsp;&nbsp; window controller open.<br>
    &nbsp;&nbsp;&nbsp; ^window! !<br>
    <br>
    !MVCToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010 01:23'!<br>
    open: anObject label: aString<br>
    &nbsp;&nbsp;&nbsp; "Build an open the object, labeling it appropriately.&nbsp; Answer
    the widget opened."<br>
    &nbsp;&nbsp;&nbsp; | window |<br>
    &nbsp;&nbsp;&nbsp; window := self build: anObject.<br>
    &nbsp;&nbsp;&nbsp; window label: aString.<br>
    &nbsp;&nbsp;&nbsp; window controller open.<br>
    &nbsp;&nbsp;&nbsp; ^window! !<br>
    <br>
    <br>
    !MorphicToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010
    01:39'!<br>
    open1: anObject<br>
    &nbsp;&nbsp;&nbsp; "Build and open the object. Answer the widget opened."<br>
    &nbsp;&nbsp;&nbsp; | morph |<br>
    &nbsp;&nbsp;&nbsp; anObject isMorph <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue:[morph := anObject]<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse:[morph := self build: anObject].<br>
    &nbsp;&nbsp;&nbsp; (morph isKindOf: MenuMorph)<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue:[morph popUpInWorld: World].<br>
    &nbsp;&nbsp;&nbsp; (morph isKindOf: SystemWindow)<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue:[morph openInWorldExtent: morph extent]<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifFalse:[morph openInWorld].<br>
    &nbsp;&nbsp;&nbsp; ^morph! !<br>
    <br>
    !MorphicToolBuilder methodsFor: 'opening' stamp: 'fm 9/8/2010
    01:41'!<br>
    open1: anObject label: aString<br>
    &nbsp;&nbsp;&nbsp; "Build an open the object, labeling it appropriately.&nbsp; Answer
    the widget opened."<br>
    &nbsp;&nbsp;&nbsp; | window |<br>
    &nbsp;&nbsp;&nbsp; window := self open: anObject.<br>
    &nbsp;&nbsp;&nbsp; window setLabel: aString.<br>
    &nbsp;&nbsp;&nbsp; ^window! !<br>
    <br>
    <br>
    !ToolBuilder class methodsFor: 'accessing' stamp: 'fm 9/8/2010
    02:28'!<br>
    default: aToolBuilder<br>
    &nbsp;&nbsp;&nbsp; "Set a new default tool builder"<br>
    &nbsp;&nbsp;&nbsp; aToolBuilder isNil ifTrue: [Processor activeProcess debug].<br>
    &nbsp;&nbsp;&nbsp; Default := aToolBuilder.! !<br>
    <br>
    !ToolBuilder class methodsFor: 'instance creation' stamp: 'fm
    9/8/2010 02:10'!<br>
    open1: aClass label: aString<br>
    &nbsp;&nbsp;&nbsp; ^self default open1: aClass label: aString! !<br>
    <br>
    <br>
  </body>
</html>