js: Bring debugging abilities up to the level of the browser - #11397
js: Bring debugging abilities up to the level of the browser#11397AtkinsSJ wants to merge 10 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe debugger now supports frame evaluation without updating original bindings. The Sequence Diagram(s)sequenceDiagram
participant js_REPL as js debugger REPL
participant Debugger
participant PausedFrame
js_REPL->>Debugger: set breakpoint and condition
Debugger->>PausedFrame: pause at breakpoint
js_REPL->>PausedFrame: evaluate condition
PausedFrame-->>js_REPL: return condition result
js_REPL->>Debugger: continue or display pause
Merge Risk: ⚪ Minimal · up to This PR adds opt-in local JavaScript debugging features without introducing a concrete merge-blocking risk; it is merge-ready after normal checks and review. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Debugger input is read by a dedicated prompt and cannot be confused with JavaScript input. Use conventional command names without the unnecessary dot prefix.
Use one GenericLexer for both the command name and its arguments. Leave the cursor positioned after the name so every command continues parsing from it without command-specific substring offsets.
This exercises the debugger functionality of the `js` utility. It generally follows the same form as test-js-ast and test-js-bytecode, but we have multiple input files per test: - `input/foo.js`: The JS file to execute in the debugger. - `input/foo.commands`: The debugger commands to execute, one per line. - `input/foo.args`: An optional file with any extra command-line args to pass to the `js` binary to run this test. - `expected/foo.txt` is then the contents of stdout and stderr. The basic test added here does not use an `.args` file, but later, we'll use it to exercise the `--pause-on-exceptions` argument.
Accept c for continue and b for break. These familiar aliases reduce typing without making the full JavaScript-oriented command names less clear.
Allow debugger sessions to pause on no exceptions, unhandled exceptions, or all exceptions. Expose the policy through both a command-line option and set and show debugger commands.
Print paused execution frames from newest to oldest with function names and available source locations. Accept bt as the familiar short form.
Allow paused-frame evaluation without writing temporary local and argument binding changes back into that frame. Preserve the existing mutating behavior by default.
Add print and p commands that evaluate expressions in the current paused frame. Use non-mutating evaluation so inspection does not alter local variables or arguments.
Expose step-over, step-into, and step-out through command names that describe their behavior directly. Also accept the corresponding GDB commands and abbreviations for users familiar with them.
Accept an optional JavaScript condition after each breakpoint location and show it when listing breakpoints. Evaluate conditions in the paused frame and resume automatically when no breakpoint should stop.
f0cfe7d to
dd13608
Compare
|
Rebased, and modified how
|
Extends
js's debugging abilities with the functionality added in #11128. The current list is: