2011-03-04 Evan Martin <evan@chromium.org>
authorevan@chromium.org <evan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2011 22:07:57 +0000 (22:07 +0000)
committerevan@chromium.org <evan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2011 22:07:57 +0000 (22:07 +0000)
        Reviewed by Tony Chang.

        [gdb] pretty-print KURL in gdb
        https://bugs.webkit.org/show_bug.cgi?id=55788

        * gdb/webkit.py: extend the pretty-printers to print WTF::CString
        and KURLGooglePrivate.  As always, "p/r" can be used to sidestep
        pretty-printing.

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

Tools/ChangeLog
Tools/gdb/webkit.py

index 767e4c5..fbcf873 100644 (file)
@@ -1,3 +1,14 @@
+2011-03-04  Evan Martin  <evan@chromium.org>
+
+        Reviewed by Tony Chang.
+
+        [gdb] pretty-print KURL in gdb
+        https://bugs.webkit.org/show_bug.cgi?id=55788
+
+        * gdb/webkit.py: extend the pretty-printers to print WTF::CString
+        and KURLGooglePrivate.  As always, "p/r" can be used to sidestep
+        pretty-printing.
+
 2011-03-03  Timothy Hatcher  <timothy@apple.com>
 
         Update the tests that use WKPageRunJavaScriptInMainFrame use the WKSerializedScriptValueRef.
index 3f25cc4..6eddd43 100644 (file)
@@ -91,6 +91,15 @@ class WTFAtomicStringPrinter(StringPrinter):
         return self.val['m_string']
 
 
+class WTFCStringPrinter(StringPrinter):
+    "Print a WTF::CString"
+    def to_string(self):
+        # The CString holds a buffer, which is a refptr to a WTF::Vector of chars.
+        vector = self.val['m_buffer']['m_ptr']['m_vector']
+        # The vector has two more layers of buffer members.
+        return vector['m_buffer']['m_buffer']
+
+
 class WTFStringPrinter(StringPrinter):
     "Print a WTF::String"
     def get_length(self):
@@ -136,6 +145,12 @@ class JSCJSStringPrinter(StringPrinter):
         return JSCUStringPrinter(self.val['m_value']).to_string()
 
 
+class WebCoreKURLGooglePrivatePrinter(StringPrinter):
+    "Print a WebCore::KURLGooglePrivate"
+    def to_string(self):
+        return WTFCStringPrinter(self.val['m_utf8']).to_string()
+
+
 class WebCoreQualifiedNamePrinter(StringPrinter):
     "Print a WebCore::QualifiedName"
 
@@ -238,7 +253,9 @@ def add_pretty_printers():
     pretty_printers = (
         (re.compile("^WTF::Vector<.*>$"), WTFVectorPrinter),
         (re.compile("^WTF::AtomicString$"), WTFAtomicStringPrinter),
+        (re.compile("^WTF::CString$"), WTFCStringPrinter),
         (re.compile("^WTF::String$"), WTFStringPrinter),
+        (re.compile("^WebCore::KURLGooglePrivate$"), WebCoreKURLGooglePrivatePrinter),
         (re.compile("^WebCore::QualifiedName$"), WebCoreQualifiedNamePrinter),
         (re.compile("^JSC::UString$"), JSCUStringPrinter),
         (re.compile("^JSC::Identifier$"), JSCIdentifierPrinter),