Closed Bug 1697742 Opened 3 years ago Closed 3 years ago

Breakpoints are not hit when debugging xpcshell tests

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(firefox91 fixed)

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Another similar bug to Bug 1697184, it seems breakpoints are broken for xpc-shell debugging.

STRs:

  • run ./mach test test_extensions_path.js --jsdebugger
  • connect to localhost:6000 with about:debugging
  • (here the test should break on the first line)
  • set a breakpoint anywhere in the test
  • resume

ER:
The test execution should stop on the breakpoint

AR:
The test doesn't stop.

Note: as a workaround, debugger; statements are still working.

I think I've seen this and it is similar to the bug around breakpoints not being applied until you restart.

If you restart both the test and the debugger without changing the breakpoints, I think you'll then find the breakpoint being hit.

See Also: → 1699676

I can confirm this bug on macOS and on Windows, and I can confirm that the workaround from #c1 works. In fact, I didn't need to restart the browser hosting the debugger; I just needed to restart the test.

Do we have a path to addressing this? I'm seeing the same issue with my WIP for Bug 1686344. More importantly, can we add a test for this behaviour?

Blocks: 1686344
Flags: needinfo?(odvarko)

Sorry for the delay, missed this NI.

It's not our top priority atm (P3, since there is a workaround), but it's something we want to have fixed.

Julian, how much work is this? Do you think you could look at this at some point?

Flags: needinfo?(odvarko) → needinfo?(jdescottes)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

I attached a patch that fixes the issue but it's mostly to explain the issue.
The xpcshell target actor is a "content process target actor" which actually lives in the parent process. It supports watcher APIs, but since it lives in the parent process it should be handled similarly to ParentProcess targets or BrowsingContext targets for parent process pages.

Tldr, I modified _getTargetActorInParentProcess so that it would also return xpcshell targets, but maybe :ochameau would have other suggestions to address this.

I'll try to look at a test, maybe we can modify devtools/server/tests/xpcshell/test_xpcshell_debugging.js to also assess the setting breakpoints (at the moment, it only checks debugger statements).

Status: ASSIGNED → NEW
Flags: needinfo?(jdescottes)
Status: NEW → ASSIGNED
Blocks: 1717049

(In reply to Nick Alexander :nalexander [he/him] from comment #2)

More importantly, can we add a test for this behaviour?

FWIW, we are landing a test for dynamically added breakpoints together with the patch

Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4aa43363e23b
Fix breakpoints for xpcshell target actors r=ochameau
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Summary: Breakpoints are not hit when debugging xpc-shell tests → Breakpoints are not hit when debugging xpcshell tests
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: