Send xpconnect stack dump and javascript dump output to OutputDebugString

RESOLVED FIXED in mozilla17

Status

()

Core
General
RESOLVED FIXED
5 years ago
3 years ago

People

(Reporter: jimm, Assigned: jimm)

Tracking

Trunk
mozilla17
x86_64
Windows 8.1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

5 years ago
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.
See Also: → bug 640542
(Assignee)

Comment 1

5 years ago
http://hg.mozilla.org/projects/elm/rev/d850e7827a2a

doh!
(Assignee)

Comment 2

5 years ago
(In reply to Jim Mathies [:jimm] from comment #1)
> http://hg.mozilla.org/projects/elm/rev/d850e7827a2a
> 
> doh!

oops, wrong bug. double doh!
(Assignee)

Comment 3

5 years ago
Created attachment 642902 [details] [diff] [review]
js dump patch
Assignee: nobody → jmathies
(Assignee)

Comment 4

5 years ago
Created attachment 642903 [details] [diff] [review]
XPCDebug patch
(Assignee)

Comment 5

5 years ago
Created attachment 642907 [details] [diff] [review]
XPCDebug patch

use printf instead of puts in DebugDump.
Attachment #642903 - Attachment is obsolete: true
(Assignee)

Updated

5 years ago
Attachment #642907 - Flags: review?(mrbkap)
(Assignee)

Updated

5 years ago
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+
(Assignee)

Comment 7

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/a85081e2fbff
(Assignee)

Updated

5 years ago
Summary: Add build option for sending console debug output to OutputDebugString → Send xpconnect stack dump and javascript dump output to OutputDebugString
(Assignee)

Updated

5 years ago
Duplicate of this bug: 640542

Comment 9

5 years ago
https://hg.mozilla.org/mozilla-central/rev/a85081e2fbff
Status: NEW → RESOLVED
Last Resolved: 5 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.
Blocks: 901187
OS: Windows 8 Metro → Windows 8.1
You need to log in before you can comment on or make changes to this bug.