[squeak-dev] stepping over non local return in a protected block

Jaromir Matas m at jaromir.net
Wed May 12 18:48:19 UTC 2021


Hi Nicolas, Christoph, all

> When debugging things like this:
>
>   [^2] ensure: [Transcript cr; show: 'done'].
>
> if we step into the protected block [^2], then step over ^2, we
> incorrectly get a BlockCannotReturn.

Found a bug inside the debugger causing this problem: #stepOver uses
#runUntilErrorOrReturnFrom: which inserts an ensure context when started.
The problem happens when the debugger simulates #aboutToReturn:through: --
before it starts executing it via #runUntilErrorOrReturnFrom this method
inserts its ensure context between #aboutToReturn:through:firstUnwindContext
and its firstUnwindContext argument! This means the inserted context will be
skipped during execution and that's the whole problem :)

The situation is captured on the enclosed screenshot. 
Screenshot_2021-05-12_202833.png
<http://forum.world.st/file/t372955/Screenshot_2021-05-12_202833.png>  

To prove this try changing #aboutToReturn and the BlockCannotReturn error is
gone:

#aboutToReturn: result through: firstUnwindContext 
	"Called from VM when an unwindBlock is found between self and its home.
	 Return to home's sender, executing unwind blocks on the way."

	self methodReturnContext return: result 

I'm not sure how to fix it but a debugger pro should figure it out way
faster than me :)





-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list