Closed Bug 390328 Opened 17 years ago Closed 6 years ago

Let nsIXPConnect::debugDumpJSStack take a file

Categories

(Core :: XPConnect, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INACTIVE
mozilla1.9beta1

People

(Reporter: mook, Assigned: mook)

Details

Attachments

(1 file, 3 obsolete files)

It would be useful for logging purposes to let nsIXPConnect::debugDumpJSStack take a FILE*, so that we could dump the JS stack to files instead of just to stdout. Looking at my stack dumps with lots of xul!nsXPCWrappedJSClass::CallMethod isn't that useful for me, unfortunately. (This is for logging, so breaking into the debugger doesn't help - in my case there's appx. 70k stacks, because I don't really know what I'm looking for yet!)
Attached patch something like this (obsolete) (deleted) — Splinter Review
Attachment #274810 - Flags: superreview?(bzbarsky)
Attachment #274810 - Flags: review?(jst)
Comment on attachment 274810 [details] [diff] [review] something like this #include <stdio.h> please. And document in the various places that the FILE* can be null and that this stdout?
Attachment #274810 - Flags: superreview?(bzbarsky) → superreview+
Attachment #274810 - Flags: review?(jst) → review+
Attached patch add comments, use <stdio.h> (obsolete) (deleted) — Splinter Review
I'm not quite sure where to put the comments (since this was mostly undocumented), so re-asking for sr? to make sure this is okay. Carrying over r+.
Assignee: nobody → mook.songbird
Attachment #274810 - Attachment is obsolete: true
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #274971 - Flags: superreview?(bzbarsky)
Attachment #274971 - Flags: review+
Comment on attachment 274971 [details] [diff] [review] add comments, use <stdio.h> I would *much* prefer that this take a fd rather than a FILE*. FILE* cannot be passed across CRT boundaries.
Attachment #274971 - Flags: review-
Attached patch use fd instead of FILE* (obsolete) (deleted) — Splinter Review
Use fd instead of FILE*; adds dependency on <io.h> instead, and removes the added comments (because there's no default - fd 0 is stdin; I have no idea how you can possibly write to it, but it's still a valid fd)
Attachment #274971 - Attachment is obsolete: true
Attachment #275048 - Flags: superreview?(benjamin)
Attachment #275048 - Flags: review?(benjamin)
Attachment #274971 - Flags: superreview?(bzbarsky)
Comment on attachment 275048 [details] [diff] [review] use fd instead of FILE* >Index: js/src/xpconnect/src/nsXPConnect.cpp >+nsXPConnect::DebugDumpJSStack(int filedesc, >- printf("failed to get nsIThreadJSContextStack service!\n"); >+ _write(filedesc, "failed to get nsIThreadJSContextStack service!\n", 47); Magic numbers are bad. Can we avoid them using the following paradigm: static const char kFailed[] = "failed to get nsIThreadJSContextStack service!\n"; _write(filedesc, kFailed, sizeof(kFailed)-1);
Attachment #275048 - Flags: superreview?(benjamin)
Attachment #275048 - Flags: review?(benjamin)
Attachment #275048 - Flags: review-
Attached patch use static const char[] (deleted) — Splinter Review
Attachment #275048 - Attachment is obsolete: true
Attachment #275717 - Flags: review?(benjamin)
Attachment #275717 - Flags: review?(benjamin) → review+
Attachment #275717 - Flags: superreview?(bzbarsky)
Attachment #275717 - Flags: approval1.9?
Comment on attachment 275717 [details] [diff] [review] use static const char[] sr=bzbarsky, but bonus points for NS_ARRAY_LENGTH(foo) instead of |sizeof(foo) - 1|
Attachment #275717 - Flags: superreview?(bzbarsky) → superreview+
NS_ARRAY_LENGTH(foo) will still count the null-termination... you would have to have NS_ARRAY_LENGTH(foo) - 1, which IMO is uglier than sizeof(foo) - 1
Attachment #275717 - Flags: approval1.9? → approval1.9+
Keywords: checkin-needed
Checking in js/src/xpconnect/idl/nsIXPConnect.idl; /cvsroot/mozilla/js/src/xpconnect/idl/nsIXPConnect.idl,v <-- nsIXPConnect.idl new revision: 1.56; previous revision: 1.55 done Checking in js/src/xpconnect/src/nsXPConnect.cpp; /cvsroot/mozilla/js/src/xpconnect/src/nsXPConnect.cpp,v <-- nsXPConnect.cpp new revision: 1.131; previous revision: 1.130 done Checking in js/src/xpconnect/src/xpcdebug.cpp; /cvsroot/mozilla/js/src/xpconnect/src/xpcdebug.cpp,v <-- xpcdebug.cpp new revision: 1.18; previous revision: 1.17 done Checking in js/src/xpconnect/src/xpcprivate.h; /cvsroot/mozilla/js/src/xpconnect/src/xpcprivate.h,v <-- xpcprivate.h new revision: 1.232; previous revision: 1.231 done Checking in js/src/xpconnect/src/xpcwrappednative.cpp; /cvsroot/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp,v <-- xpcwrappednative.cpp new revision: 1.153; previous revision: 1.152 done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M9
I backed this out due to compile errors. ../../../../dist/include/system_wrappers/io.h:3:21: error: io.h: No such file or directory Looks pretty easy to fix, but I needed to run, so backing out was the easiest. :)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: REOPENED → RESOLVED
Closed: 17 years ago6 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: