-
Notifications
You must be signed in to change notification settings - Fork 333
Improving debugging "step over" experience #14312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
| private IdentifiedLocation getIdentifiedLocation( | ||
| Tree.Function fn, int b, int e, Option<UUID> someId) { | ||
| var orig = getIdentifiedLocation((Tree) fn, b, e, someId); | ||
| var start = castToInt(fn.getName().getStartCode()) + b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not really happy about the tricks that I have to do to remove comment from the location of Tree.Function, but unless @kazcw suggest easier way to do the same, I go with this code. (Multi line) comment just cannot be part of executable IdentifiedLocation as also demonstrated by the IGV problem.
Tree.Function to simplify debugging & co.
The test was more correct before. The error does not originate from the body, it depends only on the name and arguments. |
engine/runtime-parser/src/main/java/org/enso/compiler/core/TreeToIr.java
Outdated
Show resolved
Hide resolved
engine/runtime-parser/src/main/java/org/enso/compiler/core/TreeToIr.java
Outdated
Show resolved
Hide resolved
engine/runtime-parser/src/main/java/org/enso/compiler/core/TreeToIr.java
Outdated
Show resolved
Hide resolved
engine/runtime-parser/src/main/java/org/enso/compiler/core/TreeToIr.java
Outdated
Show resolved
Hide resolved
Akirathan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing: I think that it would be better, and more correct, to test this behavior in DebuggingEnsoTest. You can, e.g., get a stack trace and see if the source section of a function contains the documentation.
Implementation: I don't like that the location of a function is changed in TreeToIr. This feels dangerous. Why don't you just modify the places that are responsible for communicating with the debugger? Maybe ExpressionNode.getSourceSection?
OK, I give it a try. Update on Dec 3:
No, that would be weird. Locations set in |
…ol flow code constructs.
Tree.Function to simplify debugging & co.192c0b0 to
c7ccdbc
Compare
|
| */ | ||
| private static Queue<SuspendedCallback> createStepOverEvents(int numSteps) { | ||
| Queue<SuspendedCallback> steps = new ArrayDeque<>(); | ||
| steps.add((event) -> event.prepareStepInto(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look @Akirathan, removal of this line means the debugger will behave well more naturally!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How so? If numSteps is 1, an empty Queue is returned. How is that more "natural"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- these are supposed to be step over steps
- is it natural that first such a step is step into?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are supposed to be step over steps
Right, my mistake.
is it natural that first such a step is step into?
Not at all. I have misread it.
| closures.contains("factorial::factorial::fac")); | ||
| assertTrue( | ||
| "Name with dots for local method: " + closures, closures.contains("factorial.fac.acc")); | ||
| assertTrue("if/then/else: " + closures, closures.contains("if_then_else")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- this change returns the test back prior to
IfThenElseIR instead ofif_then_elsefunction invocation #11365 if_then_elseis again not visible to instrumentation ...- ...but this time it is not a function call, but a control flow construct
Akirathan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few minor comments
engine/runtime/src/main/scala/org/enso/interpreter/runtime/IrToTruffle.scala
Outdated
Show resolved
Hide resolved
| */ | ||
| private static Queue<SuspendedCallback> createStepOverEvents(int numSteps) { | ||
| Queue<SuspendedCallback> steps = new ArrayDeque<>(); | ||
| steps.add((event) -> event.prepareStepInto(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How so? If numSteps is 1, an empty Queue is returned. How is that more "natural"?
...time-integration-tests/src/test/java/org/enso/interpreter/test/DebuggingControlFlowTest.java
Show resolved
Hide resolved
Co-authored-by: Pavel Marek <pavel.marek@enso.org>
Greatly improving _"stepping over"_ for `if_then_else` and `case_of` control flow constructs. The condition and the branches are no longer treated as separate functions. Thus _step over_ takes one into the selected branch rather than over. Also removing the need to _step into_ method body. This fix probably also solves the problem with stepping into a function where the breakpoint was incorrectly placed at the beginning of a function comment ([highlighted by the red box](https://github.com/user-attachments/assets/db244cc3-e578-4127-b8f4-7b1c3c9d408c)). (cherry picked from commit 1b2abdf)

Pull Request Description
Greatly improving "stepping over" for
if_then_elseandcase_ofcontrol flow constructs. The condition and the branches are no longer treated as separate functions. Thus step over takes one into the selected branch rather than over. Also removing the need to step into method body. This fix probably also solves the problem with stepping into a function where the breakpoint was incorrectly placed at the beginning of a function comment (highlighted by the red box).Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Java,