<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi Lauren --<div class="mb_sig"></div>
                                        <div><br></div><div>-1 on this version/implementation</div><div>+1 on the idea</div><div><br></div><div>I like the overall direction to keep the system running and not annoy the user too much if they make a mistake.</div><div><br></div><div>Yet, I think this one needs more discussion and iteration. I challenge the intrusive way you use to count the open debuggers. I would like to see a more lightweight watcher process.</div><div><br></div><div>I don't think that either "number of max open debuggers" nor "min delay between debuggers" etc. is an option that a user can come up with for their current system and scenario. <span style="font-size: 10pt">Well, not even the input-timeout for our list filters is really good. This is a kind of tricky UX challenge. The false-positive might be dangerous. The n+1-th debugger might be the one with useful information.</span></div><div><span style="font-size: 10pt"><br></span></div><div><span style="font-size: 10pt">We might need domain-specific groups of debuggers. One window for each group.</span></div><div><br></div><div>Can you provide an example? How to trigger a flood of debuggers. <span style="font-size: 10pt">Maybe we can find a way to group new debuggers somehow? For Morphic drawing errors, I already implemented such a domain-specific rule. See WorldState >> #displayWorldSafely:.</span></div><div><br></div><div>Best,</div><div>Marcel</div><blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 23.04.2022 23:36:45 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p><div style="font-family:Arial,Helvetica,sans-serif">A new version of Tools was added to project The Inbox:<br>http://source.squeak.org/inbox/Tools-lrnp.1147.mcz<br><br>==================== Summary ====================<br><br>Name: Tools-lrnp.1147<br>Author: lrnp<br>Time: 23 April 2022, 3:35:52.83495 pm<br>UUID: 343ce1d0-c9d3-47ec-8648-93be4d21471c<br>Ancestors: Tools-tpr.1146, Tools.lrnp-squeak5.3-debuggerFloodPrevention-20220423.6<br><br>debugger window flooding protection<br><br>Prevent the debugger from grinding the image to a halt by opening an endless torrent of windows. When a (by default) 6th debugger window would be opened within 3 seconds of opening the previous 5, the project is immediately suspended and exited so the user can attempt recovery or generate a debug log.<br><br>Comes with a preference to change the rate limit.<br><br>=============== Diff against Tools-tpr.1146 ===============<br><br>Item was changed:<br>  CodeHolder subclass: #Debugger<br>       instanceVariableNames: 'interruptedProcess contextStack contextStackIndex contextStackList receiverInspector receiverInspectorState contextVariablesInspector contextVariablesInspectorState externalInterrupt proceedValue selectingPC savedCursor isolationHead failedProject labelString message untilExpression'<br>+         classVariableNames: 'ContextStackKeystrokes ErrorReportServer FullStackSize InterruptUIProcessIfBlockedOnErrorInBackgroundProcess MaximumOpenDebuggers NotifierStackSize SavedExtent StackSizeLimit WantsAnnotationPane'<br>-     classVariableNames: 'ContextStackKeystrokes ErrorReportServer FullStackSize InterruptUIProcessIfBlockedOnErrorInBackgroundProcess NotifierStackSize SavedExtent StackSizeLimit WantsAnnotationPane'<br>   poolDictionaries: ''<br>          category: 'Tools-Debugger'!<br>+ Debugger class<br>+        instanceVariableNames: 'openInstances'!<br>  <br>  !Debugger commentStamp: 'mt 12/17/2019 12:19' prior: 0!<br>  I represent the machine state at the time of an interrupted process. I also represent a query path into the state of the process. The debugger is typically viewed through a window that views the stack of suspended contexts, the code for, and execution point in, the currently selected message, and inspectors on both the receiver of the currently selected message, and the variables in the current context.<br>  <br>  Special note on recursive errors:<br>  Some errors affect Squeak's ability to present a debugger.  This is normally an unrecoverable situation.  However, if such an error occurs in an isolation layer, Squeak will attempt to exit from the isolation layer and then present a debugger.  Here is the chain of events in such a recovery.<br>  <br>         * A recursive error is detected.<br>      * The current project is queried for an isolationHead<br>         * Changes in the isolationHead are revoked<br>    * The parent project of isolated project is returned to<br>       * The debugger is opened there and execution resumes.<br>  <br>  If the user closes that debugger, execution continues in the outer project and layer.  If, after repairing some damage, the user proceeds from the debugger, then the isolationHead is re-invoked, the failed project is re-entered, and execution resumes in that world. <br>  <br>  ---<br>  <br>  In September 2019, we added MorphicDebugger and MVCDebugger to untangle framework-specific features in our debugger infrastructure. However, this is just an intermediate step. The overall goal would be to remove those two subclasses again while preserving their functionality. Mostly, MVC and Morphic differ in their GUI-process management. This means that "proceed" and "close" work differently depending on the process that is being debugged. --- One idea is to attach that framework-specific information to the process objects. See Process >> #environmentAt: and #environmentAt:put:. Also see ToolSet's #handle* and #debug* methods.!<br>+ Debugger class<br>+   instanceVariableNames: 'openInstances'!<br><br>Item was added:<br>+ ----- Method: Debugger class>>checkDebuggerFlood (in category 'opening') -----<br>+ checkDebuggerFlood<br>+     "See if I am trying to open many debugger windows very quickly.<br>+ <br>+     When flooding is detected the current project is suspended so the user can attempt to recover their image. See #recursiveError:."<br>+ <br>+   openInstances ifNil: [openInstances := 0].<br>+   openInstances <= self maximumOpenDebuggers<br>+                ifTrue: [|proc|<br>+                      openInstances := openInstances + 1.<br>+                  proc := nil.<br>+                         proc := [<br>+                            (Delay forSeconds: 3) wait.<br>+                          openInstances := openInstances - 1 max: 0.<br>+                           proc terminate] newProcess.<br>+                  proc priority: Processor lowIOPriority.<br>+                      proc resume.<br>+                         Processor yield]<br>+             ifFalse: [openInstances := 0. Project current recursiveError: 'Debugger Flooding Detected']!<br><br>Item was changed:<br>  ----- Method: Debugger class>>initialize (in category 'class initialization') -----<br>  initialize<br>          ContextStackKeystrokes := Dictionary new<br>              at: $e put: #send;<br>            at: $t put: #doStep;<br>                  at: $T put: #stepIntoBlock;<br>           at: $p put: #proceed;<br>                 at: $r put: #restart;<br>                 at: $f put: #fullStack;<br>               at: $w put: #where;<br>           yourself.<br>+    SavedExtent := self new initialExtent.<br>+       openInstances := 0.<br>-  SavedExtent := self new initialExtent<br>  <br>     "Debugger initialize"!<br><br>Item was added:<br>+ ----- Method: Debugger class>>maximumOpenDebuggers (in category 'preferences') -----<br>+ maximumOpenDebuggers<br>+    <preference: 'maximum="" open=""></preference:><br>+              category: 'debug'<br>+            description: 'Limit the number of debugger windows that can be opened within a 3 second sliding window. When the limit is reached the current project will be exited to either MVC (if in Morphic) or Morphic (if in MVC).<br>+ <br>+ Recommended minimum is 5, also the default.'<br>+               type: #Integer><br>+   ^MaximumOpenDebuggers ifNil: [5]!<br><br>Item was added:<br>+ ----- Method: Debugger class>>maximumOpenDebuggers: (in category 'preferences') -----<br>+ maximumOpenDebuggers: anInteger<br>+ <br>+   self assert: anInteger >= 1 description: 'value must be 1 or higher'.<br>+     MaximumOpenDebuggers := anInteger!<br><br>Item was changed:<br>  ----- Method: Debugger class>>openOn:context:label:contents:fullView: (in category 'opening') -----<br>  openOn: process context: context label: titleOrNil contents: contentsStringOrNil fullView: bool<br>       "Kind of private. Open a notifier or a full debugger in response to an error, halt, or notify. Opens a project-specific debugger. Decorates that invocation with (1) recursive-error detection and (2) error logging, which are both independent from the active GUI framework, that is, MVC or Morphic.<br>         <br>      Note that clients should debug processes through Process >> #debug instead of calling this method directly."<br>  <br>   | ap title |<br>          title := titleOrNil ifNil: ['Debugger' translated].<br>   ap := Processor activeProcess.<br>+       self checkDebuggerFlood.<br>      <br>      "If the active process re-enters this method again, something went wrong with invoking the debugger."<br>       ap hasRecursiveError ifTrue: [<br>                ap clearErrorRecursionFlag.<br>           ^ ToolSet handleRecursiveError: title].<br>       <br>      "Explicitely handle logging exceptions. No need to bother the recursion mechanism here."<br>    [Preferences logDebuggerStackToFile<br>           ifTrue: [Smalltalk logSqueakError: title inContext: context]<br>          ] on: Error do: [:ex |<br>                Preferences disable: #logDebuggerStackToFile.<br>                 ToolSet debugException: ex].<br>  <br>      "If project-specific debuggers mess up, we have to flag that recursion here. Se above."<br>     [ap setErrorRecursionFlag.<br>  <br>                self informExistingDebugger: context label: title.<br>  <br>                ^ Project current debuggerClass<br>                       openOn: process context: context label: title contents: contentsStringOrNil fullView: bool<br>  <br>        ] ensure: [ap clearErrorRecursionFlag].!<br><br><br></div></blockquote></div>