Skip to content

Purpose of double Debugger.setPauseOnExceptions #41795

Closed

Description

@Delapouite

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 }),

Activity

  1. hybrist commented on Nov 13, 2017

    @hybrist
    Contributor

    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.

  2. alexkozy commented on Nov 13, 2017

    @alexkozy
    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.

  3. hybrist commented on Nov 13, 2017

    @hybrist
    Contributor

    @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.

  4. alexkozy commented on Nov 13, 2017

    @alexkozy
    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

  5. hybrist commented on Nov 13, 2017

    @hybrist
    Contributor
  6. hybrist commented on Jan 31, 2022

    @hybrist
    Contributor

    New location:

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

  7. hybrist commented on Jan 31, 2022

    @hybrist
    Contributor

    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.

  8. added
    good first issueIssues that are suitable for first-time contributors.
    debuggerIssues and PRs related to the Node.js command-line debugger.
    on Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    debuggerIssues and PRs related to the Node.js command-line debugger.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions