Last Comment Bug 762519 - Send xpconnect stack dump and javascript dump output to OutputDebugString
: Send xpconnect stack dump and javascript dump output to OutputDebugString
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: General (show other bugs)
: Trunk
: x86_64 Windows 8.1
: -- normal (vote)
: mozilla17
Assigned To: Jim Mathies [:jimm]
:
Mentors:
: 640542 (view as bug list)
Depends on:
Blocks: 901187
  Show dependency treegraph
 
Reported: 2012-06-07 08:53 PDT by Jim Mathies [:jimm]
Modified: 2014-07-24 11:06 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
js dump patch (606 bytes, patch)
2012-07-17 04:17 PDT, Jim Mathies [:jimm]
ehsan: review+
Details | Diff | Review
XPCDebug patch (7.05 KB, patch)
2012-07-17 04:17 PDT, Jim Mathies [:jimm]
no flags Details | Diff | Review
XPCDebug patch (7.04 KB, patch)
2012-07-17 04:24 PDT, Jim Mathies [:jimm]
mrbkap: review+
Details | Diff | Review

Description Jim Mathies [:jimm] 2012-06-07 08:53:30 PDT
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.
Comment 1 Jim Mathies [:jimm] 2012-07-14 14:31:40 PDT
http://hg.mozilla.org/projects/elm/rev/d850e7827a2a

doh!
Comment 2 Jim Mathies [:jimm] 2012-07-14 14:32:05 PDT
(In reply to Jim Mathies [:jimm] from comment #1)
> http://hg.mozilla.org/projects/elm/rev/d850e7827a2a
> 
> doh!

oops, wrong bug. double doh!
Comment 3 Jim Mathies [:jimm] 2012-07-17 04:17:01 PDT
Created attachment 642902 [details] [diff] [review]
js dump patch
Comment 4 Jim Mathies [:jimm] 2012-07-17 04:17:38 PDT
Created attachment 642903 [details] [diff] [review]
XPCDebug patch
Comment 5 Jim Mathies [:jimm] 2012-07-17 04:24:53 PDT
Created attachment 642907 [details] [diff] [review]
XPCDebug patch

use printf instead of puts in DebugDump.
Comment 6 Blake Kaplan (:mrbkap) (please use needinfo!) 2012-07-17 19:12:13 PDT
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.
Comment 8 Jim Mathies [:jimm] 2012-07-19 08:00:10 PDT
*** Bug 640542 has been marked as a duplicate of this bug. ***
Comment 9 Ed Morley [:emorley] 2012-07-20 06:47:15 PDT
https://hg.mozilla.org/mozilla-central/rev/a85081e2fbff
Comment 10 neil@parkwaycc.co.uk 2012-08-06 12:01:27 PDT
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 11 neil@parkwaycc.co.uk 2012-08-06 12:06:18 PDT
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.

Note You need to log in before you can comment on or make changes to this bug.