Closed Bug 1603444 Opened 5 years ago Closed 5 years ago

Breakpoints don't trigger on page restart

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1573816

People

(Reporter: Honza, Unassigned)

References

(Blocks 2 open bugs)

Details

STR:

Expected result:
Debugger stops at breakpoints

Actual result:
Only stops at debugger statements

From:
https://github.com/firefox-devtools/debugger/issues/4200

Honza

@Brian is this related to bug 1603440?

Honza

Flags: needinfo?(bhackett1024)

This is a run to completion bug: we hit the debugger statement and pause, and while we're paused the promises created by the fetch call are resolved and the code containing the breakpoint runs. The breakpoint handler is hit but we don't pause because we are already paused. Jim, do you know why this promise is being resolved when the server has paused? I've attached some stack information below for when the breakpoint handler runs.

* thread #1, name = 'MainThread', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x000000010bb9e8d0 XUL`js::DebugAPI::onTrap(cx=0x0000000106c2f000) at Debugger.cpp:2461 [opt]
    frame #1: 0x000000010b7d6f6f XUL`Interpret(cx=<unavailable>, state=0x00007ffee98df370) at Interpreter.cpp:1884 [opt]
    frame #2: 0x000000010b7d655f XUL`js::RunScript(cx=0x0000000106c2f000, state=0x00007ffee98df370) at Interpreter.cpp:424 [opt]
    frame #3: 0x000000010b7e67d6 XUL`js::InternalCallOrConstruct(cx=0x0000000106c2f000, args=<unavailable>, construct=<unavailable>, reason=<unavailable>) at Interpreter.cpp:580 [opt]
    frame #4: 0x000000010b7e6dcc XUL`js::Call(cx=<unavailable>, fval=<unavailable>, thisv=<unavailable>, args=0x00007ffee98df4a8, rval=<unavailable>, reason=<unavailable>) at Interpreter.cpp:625 [opt]
    frame #5: 0x000000010b9606ec XUL`PromiseReactionJob(JSContext*, unsigned int, JS::Value*) [inlined] js::Call(cx=<unavailable>, fval=<unavailable>, thisv=JS::HandleValue @ 0x00007ffee98df408, arg0=<unavailable>, rval=JS::MutableHandleValue @ r12) at Interpreter.h:103 [opt]
    frame #6: 0x000000010b9606bd XUL`PromiseReactionJob(cx=0x0000000106c2f000, argc=<unavailable>, vp=<unavailable>) at Promise.cpp:1854 [opt]
    frame #7: 0x000000010b7e6497 XUL`js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [inlined] CallJSNative(cx=<unavailable>, native=(XUL`PromiseReactionJob(JSContext*, unsigned int, JS::Value*) at Promise.cpp:1767), reason=<unavailable>, args=<unavailable>)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) at Interpreter.cpp:452 [opt]
    frame #8: 0x000000010b7e6394 XUL`js::InternalCallOrConstruct(cx=0x0000000106c2f000, args=0x00007ffee98df628, construct=<unavailable>, reason=<unavailable>) at Interpreter.cpp:544 [opt]
    frame #9: 0x000000010b7e6dcc XUL`js::Call(cx=<unavailable>, fval=<unavailable>, thisv=<unavailable>, args=0x00007ffee98df628, rval=<unavailable>, reason=<unavailable>) at Interpreter.cpp:625 [opt]
    frame #10: 0x000000010b87832f XUL`JS::Call(cx=0x0000000106c2f000, thisv=<unavailable>, fval=<unavailable>, args=0x00007ffee98df6f0, rval=JS::MutableHandleValue @ 0x00007ffee98df610) at jsapi.cpp:2753 [opt]
    frame #11: 0x0000000108f8a03f XUL`mozilla::dom::PromiseJobCallback::Call(this=0x000000011e8fe440, cx=0x0000000106c2f000, aThisVal=<unavailable>, aRv=0x00007ffee98df790) at PromiseBinding.cpp:27 [opt]
    frame #12: 0x000000010795c7c2 XUL`mozilla::PromiseJobRunnable::Run(mozilla::AutoSlowOperation&) [inlined] mozilla::dom::PromiseJobCallback::Call(this=0x000000011e8fe440, aRv=0x0000000000000000, aExecutionReason=<unavailable>, aExceptionHandling=eReportExceptions, aRealm=0x0000000000000000) at PromiseBinding.h:91 [opt]
    frame #13: 0x000000010795c773 XUL`mozilla::PromiseJobRunnable::Run(mozilla::AutoSlowOperation&) [inlined] mozilla::dom::PromiseJobCallback::Call(this=0x000000011e8fe440, aExecutionReason=<unavailable>) at PromiseBinding.h:104 [opt]
    frame #14: 0x000000010795c769 XUL`mozilla::PromiseJobRunnable::Run(this=0x00000001253a1560, aAso=0x00007ffee98df9b8) at CycleCollectedJSContext.cpp:205 [opt]
    frame #15: 0x000000010794eccb XUL`mozilla::CycleCollectedJSContext::PerformMicroTaskCheckPoint(this=0x0000000106ad6000, aForce=<unavailable>) at CycleCollectedJSContext.cpp:623 [opt]
    frame #16: 0x000000010794f113 XUL`mozilla::CycleCollectedJSContext::AfterProcessTask(this=0x0000000106ad6000, aRecursionDepth=<unavailable>) at CycleCollectedJSContext.cpp:452 [opt]
    frame #17: 0x0000000108361e6f XUL`XPCJSContext::AfterProcessTask(this=0x0000000106ad6000, aNewRecursionDepth=<unavailable>) at XPCJSContext.cpp:1323 [opt]
    frame #18: 0x00000001079fa40e XUL`nsThread::ProcessNextEvent(this=0x0000000106982110, aMayWait=<unavailable>, aResult=0x00007ffee98dff5f) at nsThread.cpp:1304 [opt]
    frame #19: 0x00000001079fd509 XUL`NS_ProcessNextEvent(aThread=<unavailable>, aMayWait=<unavailable>) at nsThreadUtils.cpp:486 [opt]
    frame #20: 0x000000010b715963 XUL`mozilla::jsinspector::nsJSInspector::EnterNestedEventLoop(JS::Handle<JS::Value>, unsigned int*) [inlined] bool mozilla::SpinEventLoopUntil<(mozilla::ProcessFailureBehavior)1, mozilla::jsinspector::nsJSInspector::EnterNestedEventLoop(JS::Handle<JS::Value>, unsigned int*)::$_0>(aPredicate=<unavailable>, aThread=0x0000000000000000)::$_0&&, nsIThread*) at nsThreadUtils.h:348 [opt]
    frame #21: 0x000000010b715921 XUL`mozilla::jsinspector::nsJSInspector::EnterNestedEventLoop(this=0x000000012539f130, requestor=<unavailable>, out=0x00007ffee98e0108) at nsJSInspector.cpp:74 [opt]
    frame #22: 0x0000000107a103be XUL`NS_InvokeByIndex at xptcinvoke_asm_x86_64_unix.S:106
    frame #23: 0x0000000108385fb8 XUL`XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) [inlined] CallMethodHelper::Invoke(this=<unavailable>) at XPCWrappedNative.cpp:1643 [opt]
    frame #24: 0x0000000108385f98 XUL`XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) [inlined] CallMethodHelper::Call(this=<unavailable>) at XPCWrappedNative.cpp:1184 [opt]
    frame #25: 0x0000000108385389 XUL`XPCWrappedNative::CallMethod(ccx=<unavailable>, mode=<unavailable>) at XPCWrappedNative.cpp:1150 [opt]
    frame #26: 0x0000000108387638 XUL`XPC_WN_CallMethod(cx=<unavailable>, argc=1, vp=<unavailable>) at XPCWrappedNativeJSOps.cpp:946 [opt]
    frame #27: 0x000000010b7e6497 XUL`js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [inlined] CallJSNative(cx=<unavailable>, native=(XUL`XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) at XPCWrappedNativeJSOps.cpp:922), reason=<unavailable>, args=<unavailable>)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) at Interpreter.cpp:452 [opt]
    frame #28: 0x000000010b7e6394 XUL`js::InternalCallOrConstruct(cx=0x0000000106c2f000, args=0x00007ffee98e04c0, construct=<unavailable>, reason=<unavailable>) at Interpreter.cpp:544 [opt]
    frame #29: 0x000000010b7dfc04 XUL`Interpret(JSContext*, js::RunState&) [inlined] js::CallFromStack(cx=<unavailable>, args=0x0000000106fe63b8) at Interpreter.cpp:612 [opt]
    frame #30: 0x000000010b7dfbfd XUL`Interpret(cx=<unavailable>, state=0x00007ffee98e0900) at Interpreter.cpp:3042 [opt]
    frame #31: 0x000000010b7d655f XUL`js::RunScript(cx=0x0000000106c2f000, state=0x00007ffee98e0900) at Interpreter.cpp:424 [opt]
    frame #32: 0x000000010b7e67d6 XUL`js::InternalCallOrConstruct(cx=0x0000000106c2f000, args=<unavailable>, construct=<unavailable>, reason=<unavailable>) at Interpreter.cpp:580 [opt]
    frame #33: 0x000000010bde8dec XUL`js::jit::DoCallFallback(cx=0x0000000106c2f000, frame=0x00007ffee98e0d28, stub=0x0000000125f269a8, argc=0, vp=0x00007ffee98e0cd0, res=<unavailable>) at BaselineIC.cpp:2905 [opt]
    frame #34: 0x000001a02bdd8e78
Flags: needinfo?(bhackett1024)
Flags: needinfo?(jimb)
Blocks: dbg-r2c

This definitely sounds like a duplicate of 1573816. If we're enqueuing reaction jobs for content fetches while paused, those reaction jobs would need to be added to the content microtask queue that JS::AutoDebuggerJobQueueInterruption set aside, which would be a pain in the neck. Much better to delay resolving the promise until we resume content.

See my notes about a similar problem here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1604526#c2

Flags: needinfo?(jimb)

Thanks for the analysis Jim
Marking as dup
Honza

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.