Skip to content
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

Purpose of double Debugger.setPauseOnExceptions #41795

Closed
Delapouite opened this issue Nov 10, 2017 · 7 comments · Fixed by #41838
Closed

Purpose of double Debugger.setPauseOnExceptions #41795

Delapouite opened this issue Nov 10, 2017 · 7 comments · Fixed by #41838
Labels
debugger Issues and PRs related to the debugger subsystem. good first issue Issues that are suitable for first-time contributors.

Comments

@Delapouite
Copy link
Contributor

Hi

During the init phase: https://github.com/nodejs/node-inspect/blob/master/lib/internal/inspect_repl.js#L1041

  function initAfterStart() {
    const setupTasks = [
      Runtime.enable(),
      Profiler.enable(),
      Profiler.setSamplingInterval({ interval: 100 }),
      Debugger.enable(),
      Debugger.setPauseOnExceptions({ state: 'none' }),
      Debugger.setAsyncCallStackDepth({ maxDepth: 0 }),
      Debugger.setBlackboxPatterns({ patterns: [] }),
      Debugger.setPauseOnExceptions({ state: pauseOnExceptionState }),
      restoreBreakpoints(),
      Runtime.runIfWaitingForDebugger(),
    ];
    return Promise.all(setupTasks);
  }

What's the purpose of doing Debugger.setPauseOnExceptions twice?

Debugger.setPauseOnExceptions({ state: 'none' }),
Debugger.setPauseOnExceptions({ state: pauseOnExceptionState }),
@jkrems
Copy link
Contributor

jkrems commented Nov 13, 2017

Hm, I don't think this is on purpose. I assume that the first got copied from somewhere and then I later added the 2nd line without looking properly. Nice find! I assume the first one could just be removed.

@alexkozy
Copy link
Member

It looks like pauseOnExceptionState always 'none' in second invocation. In any case from protocol point of view there is no sense to call Debugger.setPauseOnExceptions twice. Implementation of this method just changes a flag inside V8.

@jkrems
Copy link
Contributor

jkrems commented Nov 13, 2017

@ak239 Thanks for confirming!

Btw, we don't reset it before connecting/restarting. So it might not be 'none' when connecting after restart. So the hardcoded 'none' is definitely wrong and shouldn't be there.

@alexkozy
Copy link
Member

I think we should support this case on backend side. When at least one protocol client requests pause on all exceptions - debugger should issue Debugger.paused event for each exception, if at least one client request pause on uncaught exception - issue event for uncaught exception.
I filled bug against V8: issue

@jkrems
Copy link
Contributor

jkrems commented Nov 13, 2017

@jkrems
Copy link
Contributor

jkrems commented Jan 31, 2022

New location:

await Debugger.setPauseOnExceptions({ state: 'none' });
await Debugger.setAsyncCallStackDepth({ maxDepth: 0 });
await Debugger.setBlackboxPatterns({ patterns: [] });
await Debugger.setPauseOnExceptions({ state: pauseOnExceptionState });

@jkrems jkrems transferred this issue from nodejs/node-inspect Jan 31, 2022
@jkrems
Copy link
Contributor

jkrems commented Jan 31, 2022

The fix here may be to just remove the first call with the hard-coded 'none'. If the tests pass, that can likely just land.

@jkrems jkrems added good first issue Issues that are suitable for first-time contributors. debugger Issues and PRs related to the debugger subsystem. labels Jan 31, 2022
bavulapati added a commit to bavulapati/node that referenced this issue Feb 3, 2022
Removes the duplicate call of setPauseOnException() inside initAfterStart()

Fixes: nodejs#41795
Trott pushed a commit to bavulapati/node that referenced this issue Feb 4, 2022
Removes the duplicate call of setPauseOnException() inside
initAfterStart().

Fixes: nodejs#41795
nodejs-github-bot pushed a commit that referenced this issue Feb 11, 2022
Removes the duplicate call of setPauseOnException() inside
initAfterStart().

Fixes: #41795

PR-URL: #41838
Reviewed-By: Jan Krems <[email protected]>
bengl pushed a commit to bengl/node that referenced this issue Feb 21, 2022
Removes the duplicate call of setPauseOnException() inside
initAfterStart().

Fixes: nodejs#41795

PR-URL: nodejs#41838
Reviewed-By: Jan Krems <[email protected]>
bengl pushed a commit to bengl/node that referenced this issue Feb 21, 2022
Removes the duplicate call of setPauseOnException() inside
initAfterStart().

Fixes: nodejs#41795

PR-URL: nodejs#41838
Reviewed-By: Jan Krems <[email protected]>
bengl pushed a commit that referenced this issue Feb 22, 2022
Removes the duplicate call of setPauseOnException() inside
initAfterStart().

Fixes: #41795

PR-URL: #41838
Reviewed-By: Jan Krems <[email protected]>
danielleadams pushed a commit that referenced this issue Apr 21, 2022
Removes the duplicate call of setPauseOnException() inside
initAfterStart().

Fixes: #41795

PR-URL: #41838
Reviewed-By: Jan Krems <[email protected]>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Removes the duplicate call of setPauseOnException() inside
initAfterStart().

Fixes: #41795

PR-URL: #41838
Reviewed-By: Jan Krems <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Issues and PRs related to the debugger subsystem. good first issue Issues that are suitable for first-time contributors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants