<div dir="ltr">Hi Hernán!<div><br></div><div>I'm looking into it—these errors are really tough to debug!</div><div>The problem arises when you try to debug an exception: in your code example, <font face="monospace">Customer class>>#importCustomers</font> throws an exception because the file input.txt does not exist, therefore <font face="monospace">line</font> is <font face="monospace">nil</font><font face="arial, sans-serif">.</font></div><div><br></div><div>📝 Here's what I've found so far:</div><div>In my previous changeset, I changed the <font face="monospace">InstructionStream>>#willReturn</font> method so that it'll stop before actually performing a quick return once you step into it. This is used from <font face="monospace">ContextPart>>#stepToSendOrReturn</font> (👈 notice the message name).</div><div>While I was debugging this issue, I realized that there's also another place where something similar is done: <font face="monospace">ContextPart>>#runUntilErrorOrReturnFrom:</font>. This is used, for example, when you perform a "through" action. As a quick return method can only return an object, I changed <span style="font-family:monospace">#runUntilErrorOrReturnFrom:</span> to just do that instead of going through the rest of the logic.</div><div><br></div><div>I attach a fileout of the changes to <span style="font-family:monospace">ContextPart>>#runUntilErrorOrReturnFrom:</span>. It should be filed-in after having applied the original changeset, and it should fix the problem.</div><div>I don't think this is an elegant solution, but I want you to try it to see if it works on your tests or if you find more problems.</div><div><br></div><div>I'll keep looking into it!</div><div>Cheers!<br>Facu<br><br><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mar, 14 nov 2023 a las 9:35, Hernán Wilkinson (<<a href="mailto:hernan.wilkinson@10pines.com">hernan.wilkinson@10pines.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Facu,<div> there is an error with this change. I do not know exactly what it is, but you can reproduce it by filing in the attached file and debugging importCustomers from Customer class (it is a class method). The error happens when doing step over in [ line notNil ] whileTrue: ...</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 14, 2023 at 8:07 AM Hernán Wilkinson <<a href="mailto:hernan.wilkinson@10pines.com" target="_blank">hernan.wilkinson@10pines.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">This is so great!! It is a really important feature when doing TDD and the first implementation of a method is a ^true or similar.<div>The only concern I have is the change in Process>>#resume, because that impacts all the situations where #resume is sent... I know the impact is low, but is it possible to restrict that change to the debugger only or not?</div><div><br></div><div>Cheers!</div><div>Hernan.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 13, 2023 at 8:28 PM Facundo Javier Gelatti via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi!<br>I attach some code to be able to step into quick return methods from the debugger, and there's also <a href="https://drive.google.com/file/d/1Iv5-hJ4TNjmR0pG-qm02KpTxCvKzsDZC/view?usp=sharing" target="_blank">a demo video</a>. Being able to step into a quick return method is very useful, especially in situations where we are doing TDD (because the first implementation of a method probably ends up being a quick return).<br><br>Most of these changes were developed during the Camp Smalltalk event of the Smalltalks 2023 conference by me, Juan Vuletich and Felipe Zak (thank you guys!).<br><br>I included automated tests for various debugging scenarios. The class <font face="monospace">QuickReturnDebuggingTest</font> should probably be moved to an appropriate category (it's currently in the "Smalltalks 2023" category, just because the changes were developed during the conference) or be merged into another existing test class (I wasn't sure where to put it).<br><br>ℹ️ Extra interesting info: there are other places in which we're currently treating quick return methods in a special way. See for example <font face="monospace">Debugger>>#contents:notifying:</font>, which handles the special case of a normal method becoming a quick return method after saving the changes on the debugger (the stack frame is removed in that case, try it!). As a curiosity, another quirk related to quick returns is that you cannot debug an expression that will compile to a quick return (e.g. <font face="monospace">^2</font>), the debugger simply doesn't show up! None of this is modified on the code I'm submitting.<br><br>I include a summary of the changes below, that could be useful during code review 👇<br><br>Cheers!<br>Facu<br><div><br><hr style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium"></div>📝 Changes summary:<br><ul><li style="margin-left:15px">Do not run a quick return as a primitive in <font face="monospace">ContextPart>>#send:to:with:lookupIn:</font>, treat it as a normal instruction —before which we can stop— and create a new stack frame for it.</li><li style="margin-left:15px">Refactor: extracted an <font face="monospace">isPrimitive</font> variable in <font face="monospace">ContextPart>>#send:to:with:lookupIn:</font>, to avoid having repeated code.</li><li style="margin-left:15px">Changed <font face="monospace">InstructionStream>>#willReturn</font> to include quick returns there. This ends up telling the debugger that it's possible to pause the execution there.</li><li style="margin-left:15px">In <font face="monospace">Process>>#resume</font>, resolve pending quick returns before running <font face="monospace">#primitiveResume</font>, so that the VM can resume the process without having an unexpected stack frame (if you remove this, the VM crashes).</li><li style="margin-left:15px">Refactor: extracted the method <font face="monospace">Debugger class>>#newDebugging:</font>, which is useful for tests (because it does not open the debugger UI).</li></ul></div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-size:small"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></strong></span></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div style="font-size:12.8px"><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></strong></span></div><div style="font-size:12.8px"><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-size:small"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></strong></span></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div style="font-size:12.8px"><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></strong></span></div><div style="font-size:12.8px"><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div>
</blockquote></div>