Repository navigation
Conversation
`sb('fn()')` used the `debug()` command line API, which gives no
breakpoint id, so these breakpoints never showed up in `breakpoints`
and could not be removed with `cb`. Use
`Debugger.setBreakpointOnFunctionCall` instead and keep the breakpoint
in the list, so it is listed as `fn()` and can be cleared with
`cb('fn()')`.
Fixes: nodejs#41790
Co-authored-by: Dan Rose <danoftheroses@gmail.com>
Signed-off-by: dualfroz <me@dualfroz.com>
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66744 +/- ##
==========================================
+ Coverage 90.47% 90.55% +0.07%
==========================================
Files 791 801 +10
Lines 277225 284228 +7003
Branches 53313 54911 +1598
==========================================
+ Hits 250829 257380 +6551
- Misses 16801 17003 +202
- Partials 9595 9845 +250
🚀 New features to boost your workflow:
|
inoway46
left a comment
There was a problem hiding this comment.
I previously spent some time looking into the debugger code and noticed a couple of things while reviewing this change. I've left two inline suggestions about object handle cleanup and evaluation error handling.
| }); | ||
| return PromisePrototypeThen(debugCall, ({ result, wasThrown }) => { | ||
| Runtime.evaluate({ expression: functionName }); | ||
| return PromisePrototypeThen(evaluation, ({ result, wasThrown }) => { |
There was a problem hiding this comment.
Could we release result.objectId once we're done processing the evaluation result, including error paths?
The handle remains valid after Debugger.removeBreakpoint, retaining the function and potentially its captured state. Releasing it after setting the breakpoint still allows the breakpoint to fire.
Evaluation errors and non-function results can also include an objectId, so those paths should release the handle too.
| return PromisePrototypeThen(debugCall, ({ result, wasThrown }) => { | ||
| Runtime.evaluate({ expression: functionName }); | ||
| return PromisePrototypeThen(evaluation, ({ result, wasThrown }) => { | ||
| if (wasThrown) return convertResultToError(result); |
There was a problem hiding this comment.
Could we check exceptionDetails instead of wasThrown before checking result.type? Both evaluation methods report exceptions through exceptionDetails.
The wasThrown check predates this PR, but the new type check turns evaluation errors into “not a function” errors. In the new sb('x()') test, x is still uninitialized, so evaluating it throws a ReferenceError.
Could we use sb('10()') for the non-function case and test evaluation errors separately?
|
applied both, thanks. it checks exceptionDetails now and releases the handle on every path |
Fixes: #41790
picks up #53798 by @rotu (kept as co-author).
sb('fn()')wentthrough
debug()from the command line API, so there was nobreakpoint id to keep. it now uses
Debugger.setBreakpointOnFunctionCall,the breakpoint shows up in
breakpointsasfn()andcb('fn()')removes it. like before, these aren't restored after
restart.test-debugger-breakneeded a small update since the functionbreakpoint is now listed and the pause reads
break in.