RESOLVED FIXED 61149
[debug feature] WTFString should have show() method
https://bugs.webkit.org/show_bug.cgi?id=61149
Summary [debug feature] WTFString should have show() method
Ryosuke Niwa
Reported 2011-05-19 15:13:10 PDT
gdb that comes with XCode 3 doesn't support printing WTFString. We should add a show() method to WTFString to ease the pain.
Attachments
adds String::show (1.68 KB, patch)
2011-05-19 15:39 PDT, Ryosuke Niwa
no flags
adds String::show and AtomicString::show (2.71 KB, patch)
2011-05-19 16:11 PDT, Ryosuke Niwa
eric: review+
Anders Carlsson
Comment 1 2011-05-19 15:23:52 PDT
Yes please. I'm getting tired of gdb crashing when trying to print WTF Strings using p string.utf8().data();
Ryosuke Niwa
Comment 2 2011-05-19 15:26:53 PDT
(In reply to comment #1) > Yes please. I'm getting tired of gdb crashing when trying to print WTF Strings using p string.utf8().data(); Yeah, that gdb bug is driving me nuts. I don't remember how many times I had to spend minutes getting into the right breakpoint and the first "p ~~" crashed :(
Ryosuke Niwa
Comment 3 2011-05-19 15:39:20 PDT
Created attachment 94134 [details] adds String::show
Ryosuke Niwa
Comment 4 2011-05-19 15:39:59 PDT
I wonder if we should also add it to AtomicString and QualifiedName.
Ryosuke Niwa
Comment 5 2011-05-19 16:11:55 PDT
Created attachment 94138 [details] adds String::show and AtomicString::show
Ryosuke Niwa
Comment 6 2011-05-19 16:13:35 PDT
Adding it to QualifiedName is a bit tricky because we'd have to export String::show from JSC to WebCore so I'll put that aside for now.
Levi Weintraub
Comment 7 2011-05-19 16:22:29 PDT
(In reply to comment #6) > Adding it to QualifiedName is a bit tricky because we'd have to export String::show from JSC to WebCore so I'll put that aside for now. The following in your .gdbinit will allow you to type string_print followed by a WTF::String to print it out: define wchar_print echo " set $i = 0 while (1 == 1) set $c = (char)(($arg0)[$i++]) if ($c == '\0') loop_break end printf "%c", $c end echo "\n end define string_print wchar_print ($arg0) end Just sayin' ;)
Ryosuke Niwa
Comment 8 2011-05-26 14:56:57 PDT
Any reviewer?
Eric Seidel (no email)
Comment 9 2011-05-26 14:57:44 PDT
Comment on attachment 94138 [details] adds String::show and AtomicString::show OK.
Eric Seidel (no email)
Comment 10 2011-05-26 14:58:18 PDT
Since Darin authored many of our string classes, I figure he might like to see this go by, but it looks like you already CC'd him. Thanks.
Ryosuke Niwa
Comment 11 2011-05-26 14:58:57 PDT
Thanks for the review!
Ryosuke Niwa
Comment 12 2011-05-26 15:09:55 PDT
We can always remove this if it turns out be redundant or useless.
Ryosuke Niwa
Comment 13 2011-05-26 15:09:59 PDT
Note You need to log in before you can comment on or make changes to this bug.