Closed Bug 762519 Opened 8 years ago Closed 8 years ago

Send xpconnect stack dump and javascript dump output to OutputDebugString


(Core :: General, defect)

Windows 8.1
Not set





(Reporter: jimm, Assigned: jimm)




(2 files, 1 obsolete file)

I'd like to add a simple build config option that enables routing debug output to the Windows local/remote debugger via OutputDebugString. Something like "--enable-win-debug". I'm particularly interested seeing dump() and XPCDebug output, although maybe there's a way to capture everything we normally dump to the win console and send it over.
(In reply to Jim Mathies [:jimm] from comment #1)
> doh!

oops, wrong bug. double doh!
Attached patch js dump patchSplinter Review
Assignee: nobody → jmathies
Attached patch XPCDebug patch (obsolete) — Splinter Review
Attached patch XPCDebug patchSplinter Review
use printf instead of puts in DebugDump.
Attachment #642903 - Attachment is obsolete: true
Attachment #642907 - Flags: review?(mrbkap)
Attachment #642902 - Flags: review?(ehsan)
Attachment #642902 - Flags: review?(ehsan) → review+
Comment on attachment 642907 [details] [diff] [review]
XPCDebug patch

Review of attachment 642907 [details] [diff] [review]:

Nits only.

::: js/xpconnect/src/XPCDebug.cpp
@@ +277,5 @@
>  {
>      char* buf;
>      JSExceptionState *state = JS_SaveExceptionState(cx);
>      if (!state)
> +        DebugDump("Call to a debug function modifying state!\n");

It'd be slightly faster and less error-prone to make this: DebugDump("%s", "...") and below, also. Failing that, it'd be a decent idea to use the gcc warning flags to get some error coverage for bad uses.

@@ +406,1 @@
>                 (void *)obj, js::GetObjectClass(obj)->name);

Nit: re-indent the second line.
Attachment #642907 - Flags: review?(mrbkap) → review+
Summary: Add build option for sending console debug output to OutputDebugString → Send xpconnect stack dump and javascript dump output to OutputDebugString
Duplicate of this bug: 640542
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Comment on attachment 642902 [details] [diff] [review]
js dump patch

>@@ -4558,16 +4558,21 @@ nsGlobalWindow::Dump(const nsAString& aStr)
>+      OutputDebugStringA(cstr);
Nit: I would have preferred OutputDebugStringW(PromiseFlatString(aStr).get());
Comment on attachment 642907 [details] [diff] [review]
XPCDebug patch

>+  char buffer[2048];
DumpJSStack can try to dump more than 2048 characters, unfortunately.

>+  printf(buffer);
printf(buffer); is potentially unsafe; use fputs(stdout, buffer); or printf("%s", buffer);

>-        fputs(buf, stdout);
>+        DebugDump("%s\n", buf);
Confusingly, although puts adds a newline, fputs does not.
OS: Windows 8 Metro → Windows 8.1
Depends on: 1449254
You need to log in before you can comment on or make changes to this bug.