<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p>Hi all, here is your almost-weekly debugger-related bug report :D</p>
<p><b><br>
</b></p>
<p><b>Steps to reproduce:</b></p>
<p></p>
<ol style="margin-bottom:0px; margin-top:0px">
<li>Debug it:<br>
<span>self inform: #foo.</span><br>
</li><li><span>Press over.</span></li><li><span>In the dialog window, press dialog invocation.</span></li><li><span>A second debugger on the same process opens. Press debug and select any context below #inform:.</span></li></ol>
<div>Let's fork this guide into two branches:</div>
<div>A.5 In the dialog window, press OK.</div>
<div>A.6 I<span style="font-size:12pt">n the second debugger, press Over.</span></div>
<div><span style="font-size:12pt">B.5 In the second debugger, press Over.</span></div>
<div><span style="font-size: 8pt;">(well, maybe I should have refactored both branches a bit ;))</span></div>
<span style="font-size: 8pt;"></span>
<div><br>
</div>
<div><b>Expected behavior (branch-invariant):</b></div>
<div><span style="font-size:12pt">The dialog window closes.</span></div>
<div><span style="font-size:12pt">The process runs until the #inform: context is reached and then suspends.</span></div>
<div><span style="font-size:12pt">Afterward, you can continue debugging the process in the second debugger.</span></div>
<div><span style="font-size:12pt">The first debugger does not change at all.</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt"><b>Actual behavior:</b></span></div>
<div><span style="font-size:12pt">
<div><span style="font-size:12pt">A: </span><span style="font-size:12pt">Error from second debugger: aContext not in process chain!</span></div>
<div><span style="font-size:12pt">
<div><span style="font-size:12pt">
<div><span style="font-size:12pt">Reason:</span></div>
In step 5, the process has run until the #DoIt context was reached, as instructed by the first debugger.</span></div>
<div><span style="font-size:12pt">In step 6, the second debugger tries to resume a dead context.</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">B: Error </span><span style="font-size:12pt">in</span><span style="font-size:12pt"> first debugger shown (in the debugged process): UndefinedObject does not
</span><span style="font-size:12pt">respond to #findContextSuchThat:.</span><br>
</div>
<div><span style="font-size:12pt">Reason: suspendendedContext of the process is nil while stepping via the second debugger.</span></div>
</span></div>
<div><br>
</div>
</span></div>
<div><b style="font-size:12pt">Some thoughts:</b><br>
</div>
<div><span style="font-size:12pt">Using</span><span style="font-size:12pt"> any of the debuggers will bring the other one out of sync. After step 4, you are very likely to get at least one debugger error when you do some </span><span style="font-size:12pt"></span><span style="font-size:12pt">steps
 in both debuggers</span><span style="font-size:12pt">.</span><br>
</div>
<div><span style="font-size:12pt">Once, I also managed to generate just another infinite debugger chain ...</span></div>
<div><span style="font-size:12pt">This </span><span style="font-size:12pt">situation</span><span style="font-size:12pt"> occurs because #debugInvocation calls Processor>>#debug:title: directly. Usually, an UnhandledError will be raised by a halt and caught
 by the first open debugger in #runUntilErrorOrReturnFrom:. This is not the case here.</span><br>
</div>
<div><br>
</div>
<div><b>Questions:</b></div>
<div><span style="font-size:12pt">What is the actual defect?</span></div>
<div><span style="font-size:12pt"></span></div>
<div></div>
<div><br>
</div>
<div>Should we avoid opening a second debugger in #debugInvocation? Actually, I would like to keep this second debugger, as you don't lose the context from the first debugger.</div>
<div>A very primitive solution could be to replace the current implementation by a halt. Unfortunately, this gives you all the irrelevant stack noise above the invocation context (#findInvocationContext), added to the disadvantage mentioned before ...</div>
<div><br>
</div>
<div>One possible solution approach for A:</div>
<div><span style="font-size:12pt">Should we maybe implement some kind of synchronization between multiple debuggers on the same process? An approach might be to use the observer pattern and register dependent debuggers in #<span>informExistingDebugger:label:
 (and deregister them in #release, of course). Each step action in one debugger then could post-notify the other debugger, which could check if the current context is dead and, if it is, peel its context back to the next alive context.</span></span><br>
</div>
<div><span style="font-size:12pt"><span>How would you think about this? :)</span></span></div>
<div><span style="font-size:12pt"><span><br>
</span></span></div>
<div><span style="font-size:12pt"><span>I would be very happy to hear your knowledge & thoughts about both issues! :-)</span></span></div>
<div><span style="font-size:12pt"><span><br>
</span></span></div>
<div><span style="font-size:12pt"><span>Best,</span></span></div>
<div><span style="font-size:12pt"><span>Christoph</span></span></div>
<p></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
</body>
</html>