dolphinsmalltalk / Dolphin

Dolphin Smalltalk Core Image
MIT License
294 stars 58 forks source link

Debugger: Restarting a block frame suspended in its final send may just continue #1268

Open blairmcg opened 6 months ago

blairmcg commented 6 months ago

Sometimes restarting a block frame in the debugger may cause execution to just return from the block and continue.

To Reproduce

  1. Evaluate the following expression in a workspace:
    #(#(1 1) #(3 4) #(4 5))
        do: [:pair | Transcript print: pair; cr. self assert: [pair first = pair second]]
  2. When the walkback occurs for the assertion failure, click Debug
  3. Click on the block frame, 3rd down. Note that pair argument has value #(3 4) and that and the first pair have been printed to the Transcript.
  4. Flip into Disassembly mode, note that the method contains no Break instructions (i.e. it is a release build)
  5. Debug/Restart
  6. Click on the block frame, 3rd down. Note the value of the pair argument is now #(4 5), and also that only this has been printed to the Transcript.
  7. In disassembly mode, note that the method still contains no Break instructions.
  8. Debug/Restart again

Expected behavior The frame should have been restarted to reprocess #(3 4), but instead the block returned and the loop continued to the next pair. We'd also have expected the method to have been translated to a debug method at step 5.

Additional context

I've been noticing this bug a lot while working on Dolphin 8, and had lumped it in with other resulting from compiler changes that have broken the release->debug ip mapping, but the bug is also present in Dolphin 7.1 and X6. In fact I had to go back to Dolphin 5 to find a version that worked as expected. The bug is somehow related to the conversion of frames from release to debug, as (aside from in X6) it does not occur if the expression is started with 'Debug It' and then continued so that the block frame is already a debug frame when later restarted. Also it does not seem to occur unless the frame is suspended in the final message send in the block.

blairmcg commented 6 months ago

May be related to or a duplicate of #281