- Revision
- 160941
- Author
- bjone...@adobe.com
- Date
- 2013-12-20 16:05:40 -0800 (Fri, 20 Dec 2013)
Log Message
Pretty print LayoutUnit, LayoutPoint, and LayoutSize in gdb and lldb
https://bugs.webkit.org/show_bug.cgi?id=126080
Reviewed by Anders Carlsson.
This changes the output of printing LayoutUnits to be in px, removing
the need to divide by 64 manually.
This will lead to gdb output like:
m_frameRect = {
m_location = LayoutPoint(0px, 0px),
m_size = LayoutSize(800px, 585px)
}
And lldb output like:
(const WebCore::LayoutRect) $0 = {
m_location = { x = 744px, y = 1px }
m_size = { width = 236px, height = 40px }
}
This patch is based on patch for Blink by cbiesin...@chromium.org.
* gdb/webkit.py:
(WebCoreLayoutUnitPrinter):
(WebCoreLayoutUnitPrinter.__init__):
(WebCoreLayoutUnitPrinter.to_string):
(WebCoreLayoutSizePrinter):
(WebCoreLayoutSizePrinter.__init__):
(WebCoreLayoutSizePrinter.to_string):
(WebCoreLayoutPointPrinter):
(WebCoreLayoutPointPrinter.__init__):
(WebCoreLayoutPointPrinter.to_string):
(add_pretty_printers):
* lldb/lldb_webkit.py:
(__lldb_init_module):
(WebCoreLayoutUnit_SummaryProvider):
(WebCoreLayoutSize_SummaryProvider):
(WebCoreLayoutPoint_SummaryProvider):
(WebCoreLayoutUnitProvider):
(WebCoreLayoutUnitProvider.__init__):
(WebCoreLayoutUnitProvider.to_string):
(WebCoreLayoutSizeProvider):
(WebCoreLayoutSizeProvider.__init__):
(WebCoreLayoutSizeProvider.get_width):
(WebCoreLayoutSizeProvider.get_height):
(WebCoreLayoutPointProvider):
(WebCoreLayoutPointProvider.__init__):
(WebCoreLayoutPointProvider.get_x):
(WebCoreLayoutPointProvider.get_y):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (160940 => 160941)
--- trunk/Tools/ChangeLog 2013-12-20 23:56:38 UTC (rev 160940)
+++ trunk/Tools/ChangeLog 2013-12-21 00:05:40 UTC (rev 160941)
@@ -1,3 +1,57 @@
+2013-12-20 Bem Jones-Bey <bjone...@adobe.com>
+
+ Pretty print LayoutUnit, LayoutPoint, and LayoutSize in gdb and lldb
+ https://bugs.webkit.org/show_bug.cgi?id=126080
+
+ Reviewed by Anders Carlsson.
+
+ This changes the output of printing LayoutUnits to be in px, removing
+ the need to divide by 64 manually.
+
+ This will lead to gdb output like:
+
+ m_frameRect = {
+ m_location = LayoutPoint(0px, 0px),
+ m_size = LayoutSize(800px, 585px)
+ }
+
+ And lldb output like:
+
+ (const WebCore::LayoutRect) $0 = {
+ m_location = { x = 744px, y = 1px }
+ m_size = { width = 236px, height = 40px }
+ }
+
+ This patch is based on patch for Blink by cbiesin...@chromium.org.
+
+ * gdb/webkit.py:
+ (WebCoreLayoutUnitPrinter):
+ (WebCoreLayoutUnitPrinter.__init__):
+ (WebCoreLayoutUnitPrinter.to_string):
+ (WebCoreLayoutSizePrinter):
+ (WebCoreLayoutSizePrinter.__init__):
+ (WebCoreLayoutSizePrinter.to_string):
+ (WebCoreLayoutPointPrinter):
+ (WebCoreLayoutPointPrinter.__init__):
+ (WebCoreLayoutPointPrinter.to_string):
+ (add_pretty_printers):
+ * lldb/lldb_webkit.py:
+ (__lldb_init_module):
+ (WebCoreLayoutUnit_SummaryProvider):
+ (WebCoreLayoutSize_SummaryProvider):
+ (WebCoreLayoutPoint_SummaryProvider):
+ (WebCoreLayoutUnitProvider):
+ (WebCoreLayoutUnitProvider.__init__):
+ (WebCoreLayoutUnitProvider.to_string):
+ (WebCoreLayoutSizeProvider):
+ (WebCoreLayoutSizeProvider.__init__):
+ (WebCoreLayoutSizeProvider.get_width):
+ (WebCoreLayoutSizeProvider.get_height):
+ (WebCoreLayoutPointProvider):
+ (WebCoreLayoutPointProvider.__init__):
+ (WebCoreLayoutPointProvider.get_x):
+ (WebCoreLayoutPointProvider.get_y):
+
2013-12-20 Martin Robinson <mrobin...@igalia.com>
[GTK] [CMake] Add support for building ImageDiff
Modified: trunk/Tools/gdb/webkit.py (160940 => 160941)
--- trunk/Tools/gdb/webkit.py 2013-12-20 23:56:38 UTC (rev 160940)
+++ trunk/Tools/gdb/webkit.py 2013-12-21 00:05:40 UTC (rev 160941)
@@ -166,6 +166,33 @@
return WTFStringPrinter(self.val['m_value']).to_string()
+class WebCoreLayoutUnitPrinter:
+ "Print a WebCore::LayoutUnit"
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ return "%gpx" % (self.val['m_value'] / 64.0)
+
+
+class WebCoreLayoutSizePrinter:
+ "Print a WebCore::LayoutSize"
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ return 'LayoutSize(%s, %s)' % (WebCoreLayoutUnitPrinter(self.val['m_width']).to_string(), WebCoreLayoutUnitPrinter(self.val['m_height']).to_string())
+
+
+class WebCoreLayoutPointPrinter:
+ "Print a WebCore::LayoutPoint"
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ return 'LayoutPoint(%s, %s)' % (WebCoreLayoutUnitPrinter(self.val['m_x']).to_string(), WebCoreLayoutUnitPrinter(self.val['m_y']).to_string())
+
+
class WebCoreQualifiedNamePrinter(StringPrinter):
"Print a WebCore::QualifiedName"
@@ -271,6 +298,9 @@
(re.compile("^WTF::CString$"), WTFCStringPrinter),
(re.compile("^WTF::String$"), WTFStringPrinter),
(re.compile("^WTF::StringImpl$"), WTFStringImplPrinter),
+ (re.compile("^WebCore::LayoutUnit$"), WebCoreLayoutUnitPrinter),
+ (re.compile("^WebCore::LayoutPoint$"), WebCoreLayoutPointPrinter),
+ (re.compile("^WebCore::LayoutSize$"), WebCoreLayoutSizePrinter),
(re.compile("^WebCore::QualifiedName$"), WebCoreQualifiedNamePrinter),
(re.compile("^JSC::Identifier$"), JSCIdentifierPrinter),
(re.compile("^JSC::JSString$"), JSCJSStringPrinter),
Modified: trunk/Tools/lldb/lldb_webkit.py (160940 => 160941)
--- trunk/Tools/lldb/lldb_webkit.py 2013-12-20 23:56:38 UTC (rev 160940)
+++ trunk/Tools/lldb/lldb_webkit.py 2013-12-21 00:05:40 UTC (rev 160941)
@@ -41,6 +41,9 @@
debugger.HandleCommand('type summary add --expand -F lldb_webkit.WTFMediaTime_SummaryProvider WTF::MediaTime')
debugger.HandleCommand('type synthetic add -x "WTF::Vector<.+>$" --python-class lldb_webkit.WTFVectorProvider')
debugger.HandleCommand('type synthetic add -x "WTF::HashTable<.+>$" --python-class lldb_webkit.WTFHashTableProvider')
+ debugger.HandleCommand('type summary add -F lldb_webkit.WebCoreLayoutUnit_SummaryProvider WebCore::LayoutUnit')
+ debugger.HandleCommand('type summary add -F lldb_webkit.WebCoreLayoutSize_SummaryProvider WebCore::LayoutSize')
+ debugger.HandleCommand('type summary add -F lldb_webkit.WebCoreLayoutPoint_SummaryProvider WebCore::LayoutPoint')
def WTFString_SummaryProvider(valobj, dict):
provider = WTFStringProvider(valobj, dict)
@@ -79,6 +82,20 @@
return "{ %d/%d, %f }" % (provider.timeValue(), provider.timeScale(), float(provider.timeValue()) / provider.timeScale())
+def WebCoreLayoutUnit_SummaryProvider(valobj, dict):
+ provider = WebCoreLayoutUnitProvider(valobj, dict)
+ return "{ %s }" % provider.to_string()
+
+
+def WebCoreLayoutSize_SummaryProvider(valobj, dict):
+ provider = WebCoreLayoutSizeProvider(valobj, dict)
+ return "{ width = %s, height = %s }" % (provider.get_width(), provider.get_height())
+
+
+def WebCoreLayoutPoint_SummaryProvider(valobj, dict):
+ provider = WebCoreLayoutPointProvider(valobj, dict)
+ return "{ x = %s, y = %s }" % (provider.get_x(), provider.get_y())
+
# FIXME: Provide support for the following types:
# def WTFVector_SummaryProvider(valobj, dict):
# def WTFCString_SummaryProvider(valobj, dict):
@@ -184,6 +201,39 @@
return impl.to_string()
+class WebCoreLayoutUnitProvider:
+ "Print a WebCore::LayoutUnit"
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+
+ def to_string(self):
+ return "%gpx" % (self.valobj.GetChildMemberWithName('m_value').GetValueAsUnsigned(0) / 64.0)
+
+
+class WebCoreLayoutSizeProvider:
+ "Print a WebCore::LayoutSize"
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+
+ def get_width(self):
+ return WebCoreLayoutUnitProvider(self.valobj.GetChildMemberWithName('m_width'), dict).to_string()
+
+ def get_height(self):
+ return WebCoreLayoutUnitProvider(self.valobj.GetChildMemberWithName('m_height'), dict).to_string()
+
+
+class WebCoreLayoutPointProvider:
+ "Print a WebCore::LayoutPoint"
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+
+ def get_x(self):
+ return WebCoreLayoutUnitProvider(self.valobj.GetChildMemberWithName('m_x'), dict).to_string()
+
+ def get_y(self):
+ return WebCoreLayoutUnitProvider(self.valobj.GetChildMemberWithName('m_y'), dict).to_string()
+
+
class WTFVectorProvider:
def __init__(self, valobj, internal_dict):
self.valobj = valobj