Closed
Bug 1385364
Opened 8 years ago
Closed 8 years ago
Invalid strings throw exceptions with gdb prettyprinters
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla57
| Tracking | Status | |
|---|---|---|
| firefox57 | --- | fixed |
People
(Reporter: sfink, Assigned: sfink)
Details
Attachments
(1 file, 1 obsolete file)
|
2.72 KB,
patch
|
jimb
:
review+
|
Details | Diff | Splinter Review |
Actually, I'm filing this for a grab bag of string output enhancements. But the most annoying thing is when I have a string pointing into 0x2f2f2f2f memory; it ends up filling up my emacs buffer with crap.
| Assignee | ||
Comment 1•8 years ago
|
||
I know, I should write tests. Feel free to throw it back to me for that. I'm just cleaning out my patch queue right now.
Attachment #8891432 -
Flags: review?(jimb)
Comment 2•8 years ago
|
||
Comment on attachment 8891432 [details] [diff] [review]
gdb JSString prettyprinter string length limit and invalid char handling
Review of attachment 8891432 [details] [diff] [review]:
-----------------------------------------------------------------
I had a suggestion for a simplification, but this is definitely an improvement, so I'm also approving it as is.
::: js/src/gdb/mozilla/JSString.py
@@ +43,5 @@
> + 0x2b2b2b2b: 'JS_SWEPT_NURSERY_PATTERN',
> + 0xe5e5e5e5: 'jemalloc freed memory',
> + }.get(flags & 0xffffffff)
> + if invalid:
> + for ch in "<INVALID:%s>" % invalid:
I love this.
@@ +53,2 @@
> yield c
> + maxlen -= 1
All this maxlen management is really weird. Since we're generating characters, couldn't we just impose the limit in the to_string method below, and just let the generators' laziness take care of things?
Attachment #8891432 -
Flags: review?(jimb) → review+
| Assignee | ||
Comment 3•8 years ago
|
||
(In reply to Jim Blandy :jimb from comment #2)
> @@ +53,2 @@
> > yield c
> > + maxlen -= 1
>
> All this maxlen management is really weird. Since we're generating
> characters, couldn't we just impose the limit in the to_string method below,
> and just let the generators' laziness take care of things?
Yes, and that is a clear and obvious way to do it, and now I feel awfully stupid for not seeing it.
Hm... would you be ok with me changing s/"<INVALID:%s>"/"<CORRUPT:%s"/? The problem is that I was debugging a test case that intentionally inserts an invalid codepoint (or whatever they're called) at the very beginning, so this code produced "<INVALID>". Which I misinterpreted to mean the same thing as one of these "<INVALID:blahblah>" things, namely that the string was bogus. But it wasn't; it just contained problematic data.
Actually, I'd like to go farther than that. I'll ask my question via a followup patch. Thanks for the review.
| Assignee | ||
Comment 4•8 years ago
|
||
Attachment #8891558 -
Flags: review?(jimb)
| Assignee | ||
Updated•8 years ago
|
Attachment #8891432 -
Attachment is obsolete: true
Comment 5•8 years ago
|
||
Comment on attachment 8891558 [details] [diff] [review]
gdb JSString prettyprinter string length limit and invalid char handling,
Review of attachment 8891558 [details] [diff] [review]:
-----------------------------------------------------------------
This looks great - thanks very much!
Attachment #8891558 -
Flags: review?(jimb) → review+
Pushed by sfink@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/847333a06c62
gdb JSString prettyprinter string length limit and invalid char handling, r=jimb
Comment 7•8 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox57:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in
before you can comment on or make changes to this bug.
Description
•