webkit.py: Really fix the printing of StringImpl now that 8-bit strings are present.
authorkubo@profusion.mobi <kubo@profusion.mobi@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Dec 2011 02:07:23 +0000 (02:07 +0000)
committerkubo@profusion.mobi <kubo@profusion.mobi@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Dec 2011 02:07:23 +0000 (02:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=73878

Reviewed by Tony Chang.

r98624 turned StringImpl::m_data into StringImpl::{m_data8,m_data16}.
r98785 made webkit.py always use m_data16, which does not work when
the string is an 8-bit string (such as KURL::string()).

I was not able to directly call StringImpl::is8Bit() in the Python
code, so I just reproduced the implementation there.

* gdb/webkit.py:
(WTFStringPrinter.is_8bit): Reproduced StringImpl::is8Bit().
(WTFStringPrinter.to_string):
(JSCUStringPrinter.is_8bit): Reproduced StringImpl::is8Bit().
(JSCUStringPrinter.to_string):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@102083 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/gdb/webkit.py

index fa1fb99..902eecc 100644 (file)
@@ -1,3 +1,23 @@
+2011-12-05  Raphael Kubo da Costa  <kubo@profusion.mobi>
+
+        webkit.py: Really fix the printing of StringImpl now that 8-bit strings are present.
+        https://bugs.webkit.org/show_bug.cgi?id=73878
+
+        Reviewed by Tony Chang.
+
+        r98624 turned StringImpl::m_data into StringImpl::{m_data8,m_data16}.
+        r98785 made webkit.py always use m_data16, which does not work when
+        the string is an 8-bit string (such as KURL::string()).
+
+        I was not able to directly call StringImpl::is8Bit() in the Python
+        code, so I just reproduced the implementation there.
+
+        * gdb/webkit.py:
+        (WTFStringPrinter.is_8bit): Reproduced StringImpl::is8Bit().
+        (WTFStringPrinter.to_string):
+        (JSCUStringPrinter.is_8bit): Reproduced StringImpl::is8Bit().
+        (JSCUStringPrinter.to_string):
+
 2011-12-05  Eric Seidel  <eric@webkit.org>
 
         Up the "expected ram for each DRT instance" to 400MB instead of 300MB
index 83a3e8a..9236603 100644 (file)
@@ -107,11 +107,19 @@ class WTFStringPrinter(StringPrinter):
             return 0
         return self.val['m_impl']['m_ptr']['m_length']
 
+    def is_8bit(self):
+        return self.val['m_impl']['m_ptr']['m_hashAndFlags'] & self.val['m_impl']['m_ptr']['s_hashFlag8BitBuffer']
+
     def to_string(self):
         if self.get_length() == 0:
             return '(null)'
 
-        return ustring_to_string(self.val['m_impl']['m_ptr']['m_data16'],
+        if self.is_8bit():
+            data_member = 'm_data8'
+        else:
+            data_member = 'm_data16'
+
+        return ustring_to_string(self.val['m_impl']['m_ptr'][data_member],
                                  self.get_length())
 
 
@@ -122,11 +130,19 @@ class JSCUStringPrinter(StringPrinter):
             return 0
         return self.val['m_impl']['m_ptr']['m_length']
 
+    def is_8bit(self):
+        return self.val['m_impl']['m_ptr']['m_hashAndFlags'] & self.val['m_impl']['m_ptr']['s_hashFlag8BitBuffer']
+
     def to_string(self):
         if self.get_length() == 0:
             return ''
 
-        return ustring_to_string(self.val['m_impl']['m_ptr']['m_data16'],
+        if self.is_8bit():
+            data_member = 'm_data8'
+        else:
+            data_member = 'm_data16'
+
+        return ustring_to_string(self.val['m_impl']['m_ptr'][data_member],
                                  self.get_length())