Closed Bug 1047403 Opened 7 years ago Closed 7 years ago

Printing std:stringstream requires a bunch of duplicated goop for android


(Core :: XPCOM, defect)

Gonk (Firefox OS)
Not set





(Reporter: kats, Assigned: kats)




(1 file, 1 obsolete file)

Bug 1027496 buffered various debug output into std::stringstream before dumping it to stderr/logcat. Bug 1030245 fixed the issue where the output was getting truncated on android. However this required a bunch of duplicated code which is only really needed on android. We can refactor this to do better.
Attached patch Patch (obsolete) — Splinter Review
What I had in mind. Still building/testing this.
Attachment #8466201 - Attachment description: WIP → Patch
Attachment #8466201 - Flags: review?(nfroyd)
Attachment #8466201 - Flags: review?(bgirard)
Comment on attachment 8466201 [details] [diff] [review]

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

::: xpcom/glue/nsDebug.h
@@ +13,5 @@
>  #include "nsXPCOM.h"
>  #include "mozilla/Assertions.h"
>  #include "mozilla/Likely.h"
>  #include <stdarg.h>
> +#include <sstream>

stringstream should be forward declared if possible, nsDebug.h is a common include. I think we can use '#include <iosfwd>' for this?
Attachment #8466201 - Flags: review?(bgirard) → review+
Good point. I moved the sstream include to nsCRTGlue.cpp and used iosfwd in nsDebug.h.

Build-only try push:
Doesn't seem to like iosfwd that much.

New try with the original patch:
Comment on attachment 8466201 [details] [diff] [review]

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

I would really like to see <iosfwd> work, and your current try push seems to be blowing up.  Can you investigate?
Attachment #8466201 - Flags: review?(nfroyd)
My local linux build also will not find <iosfwd> for some reason. Although there are definitely files including it, because if I copy the bits of iosfwd that I need into nsDebug.h, I get a duplicate definition error and the compiler claims iosfwd was already included.

Also the try push shows OS X errors which will likely need a fix such as pointed to at
Latest failed attempt:

Seems like STL requires infallible new, and xpcom/glue uses fallible new? At least in the context of the "sample program". I might just move this to LayersLogging.cpp or somewhere not so stringent with obscure requirements.
Attached patch PatchSplinter Review
I moved it to LayersLogging since I got too frustrated with trying to put it in nsDebug.h. This works just fine:
Attachment #8466201 - Attachment is obsolete: true
Attachment #8466662 - Flags: review?(bgirard)
Attachment #8466662 - Flags: review?(bgirard) → review+
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.