Closed Bug 884330 Opened 11 years ago Closed 10 years ago

Leaving the debugger instance running and restarting the main browser should reconnect (and let you debug startup)

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 814298

People

(Reporter: Gijs, Unassigned)

Details

(Whiteboard: [chrome-debug])

As in summary. Because we can't debug startup right now, and this would be a somewhat intuitive way of getting that working. Maybe?
This would also be a NTH for the tb-debugger. I was thinking about startup debug recently and thought maybe there could be some way to block startup until the remote debugger connects? This way the user could either start the debug server app with a specific commandline flag or click on a button in the app to make it stick for the next restart.
Blocks: tb-debugger
See also bug 814298.
Whiteboard: [chrome-debug]
Severity: enhancement → normal
Just noticed that bug but then we had a mid-air, sorry for the noise. The two bugs are very similar.
No longer blocks: tb-debugger
cool bug!
Priority: -- → P3
I've just had an idea on how we might achieve this.  The main problem, as I see it, is connecting the debugger to the debuggee before running the code to be debugged in question.  Start-up being what it is, that's not always easy.

So what if the debuggee had access to a specialized JSM, RestartDebug.jsm:

Components.utils.import("resource://gre/modules/debugger/RestartDebug.jsm");
RestartDebug.connectToDebuggerNow();
// then the rest of your code to be debugged

This module would do something a bit unusual:  instead of the debugger trying to connect to the debuggee at localhost:6000, the debuggee application would send a ping to another localhost port that the debugger is a server for.  If the connection is established, the debuggee asks the debugger to connect on 6000, and holds execution synchronously for that latter connection to be established.  If no debuggee-to-debugger connection is established within, say, two seconds, the debuggee writes a big warning to the error console and lets the rest of the debuggee code execute.

Other modules / components code expecting a debugger to attach early would write:

Components.utils.import("resource://gre/modules/debugger/RestartDebug.jsm");
RestartDebug.waitForDebugger();

I'm thinking a synchronous execution block, while generally nasty, might be a way to make this reliable.  Or maybe a yield statement inside a generator.

One disadvantage is that RestartDebug.jsm itself could not import any JSM's or JS-based components.  Not even XPCOMUtils for QueryInterface.

Any opinions?
:( I forgot about chrome workers, which means RestartDebug might have to be a native-code implementation like the Console API rewrite.
This is essentially a duplicate of bug 814298. I don't think this bug is different enough to leave it open on its own.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.