Skip to content

Conversation

@jbdoderlein
Copy link
Contributor

Add restart frame support to the DAP.

Demo :

restartframe.mp4

@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

❌ Patch coverage is 49.29577% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 46%. Comparing base (e55b577) to head (da89804).

Files with missing lines Patch % Lines
...g/rascalmpl/interpreter/result/RascalFunction.java 69% 21 Missing and 9 partials ⚠️
src/org/rascalmpl/dap/RascalDebugAdapter.java 0% 13 Missing ⚠️
src/org/rascalmpl/debug/DebugHandler.java 0% 10 Missing ⚠️
src/org/rascalmpl/dap/RascalDebugEventTrigger.java 0% 7 Missing ⚠️
src/org/rascalmpl/interpreter/Evaluator.java 20% 3 Missing and 1 partial ⚠️
...eter/control_exceptions/RestartFrameException.java 0% 4 Missing ⚠️
...scalmpl/debug/AbstractInterpreterEventTrigger.java 0% 2 Missing ⚠️
src/org/rascalmpl/debug/DebugMessageFactory.java 0% 1 Missing ⚠️
src/org/rascalmpl/debug/IDebugMessage.java 0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2582   +/-   ##
=======================================
- Coverage       46%     46%   -1%     
+ Complexity    6643    6642    -1     
=======================================
  Files          793     794    +1     
  Lines        65719   65773   +54     
  Branches      9844    9851    +7     
=======================================
+ Hits         30602   30612   +10     
- Misses       32759   32802   +43     
- Partials      2358    2359    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@DavyLandman DavyLandman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly fine, I have one place where I want to ask @jurgenvinju to take a look once he's back.

Comment on lines 365 to 382
// Handle frame restart at this level
// Restore environment state and retry execution
// Continue the while loop to retry the call
if(ctx instanceof Evaluator) {
Evaluator evaluator = (Evaluator) ctx;
var stackTrace = evaluator.getCurrentStack();
if(stackTrace.size() == 1){ // should not happen because this is the REPL frame
throw new ImplementationError("Cannot restart frame of the REPL");
}
if (rfe.getTargetFrameId() == stackTrace.size() -1) { // the frame to restart
restartFrame = true;
continue; // restart the frame by continuing the while loop
}
else { // not the frame to restart, rethrow to let upper frames handle it
throw rfe;
}
}
throw new ImplementationError("Frame restart is only supported in Evaluator contexts");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is something for @jurgenvinju to review.

@jbdoderlein
Copy link
Contributor Author

With the exception breakpoint PR merged, I adapted the code so that it's now possible to restart a frame when hitting a breakpoint exception :

restartonexception.mp4

@DavyLandman
Copy link
Member

@jurgenvinju can you do a final review?

}

@Override
public Result<IValue> call(Type[] actualStaticTypes, IValue[] actuals, Map<String, IValue> keyArgValues) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wrap of the whole function body in a while is a bit extreme, the args & types shouldn't change, so is there no way to make the while loop much closer to the actual body eval of this function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants