Title: [233375] trunk/Tools
Revision
233375
Author
dba...@webkit.org
Date
2018-06-29 16:17:45 -0700 (Fri, 29 Jun 2018)

Log Message

[lldb-webkit] Non-empty strings may be pretty-printed as empty
https://bugs.webkit.org/show_bug.cgi?id=187185

Reviewed by Simon Fraser.

For some reason lldb(1) sometimes has an issue accessing members of WTF::StringImplShape
via a WTF::StringImpl pointer (why?). Explicitly casting a WTF::StringImpl* to a
WTF::StringImplShape* before accessing such members makes LLDB happy.

I tried writing a test for this both for the LLVM project and to add to our lldb_webkit unit
tests to no avail. I have only been able to reproduce this bug sporadically during my WebCore/WebKit
debugging sessions so far.

* lldb/lldb_webkit.py:
(WTFStringImplProvider.__init__): Explicitly cast the WTF::StringImpl* to WTF::StringImplShape*.
(WTFStringImplProvider.get_data8): Update code now that we are directly accessing WTF::StringImplShape*.
(WTFStringImplProvider.get_data16): Ditto.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (233374 => 233375)


--- trunk/Tools/ChangeLog	2018-06-29 22:56:29 UTC (rev 233374)
+++ trunk/Tools/ChangeLog	2018-06-29 23:17:45 UTC (rev 233375)
@@ -1,3 +1,23 @@
+2018-06-29  Daniel Bates  <daba...@apple.com>
+
+        [lldb-webkit] Non-empty strings may be pretty-printed as empty
+        https://bugs.webkit.org/show_bug.cgi?id=187185
+
+        Reviewed by Simon Fraser.
+
+        For some reason lldb(1) sometimes has an issue accessing members of WTF::StringImplShape
+        via a WTF::StringImpl pointer (why?). Explicitly casting a WTF::StringImpl* to a
+        WTF::StringImplShape* before accessing such members makes LLDB happy.
+
+        I tried writing a test for this both for the LLVM project and to add to our lldb_webkit unit
+        tests to no avail. I have only been able to reproduce this bug sporadically during my WebCore/WebKit
+        debugging sessions so far.
+
+        * lldb/lldb_webkit.py:
+        (WTFStringImplProvider.__init__): Explicitly cast the WTF::StringImpl* to WTF::StringImplShape*.
+        (WTFStringImplProvider.get_data8): Update code now that we are directly accessing WTF::StringImplShape*.
+        (WTFStringImplProvider.get_data16): Ditto.
+
 2018-06-29  Chris Dumez  <cdu...@apple.com>
 
         WebKitLegacy: Can trigger recursive loads triggering debug assertions

Modified: trunk/Tools/lldb/lldb_webkit.py (233374 => 233375)


--- trunk/Tools/lldb/lldb_webkit.py	2018-06-29 22:56:29 UTC (rev 233374)
+++ trunk/Tools/lldb/lldb_webkit.py	2018-06-29 23:17:45 UTC (rev 233375)
@@ -231,16 +231,19 @@
 
 class WTFStringImplProvider:
     def __init__(self, valobj, dict):
-        self.valobj = valobj
+        # FIXME: For some reason lldb(1) sometimes has an issue accessing members of WTF::StringImplShape
+        # via a WTF::StringImpl pointer (why?). As a workaround we explicitly cast to WTF::StringImplShape*.
+        string_impl_shape_ptr_type = valobj.GetTarget().FindFirstType('WTF::StringImplShape').GetPointerType()
+        self.valobj = valobj.Cast(string_impl_shape_ptr_type)
 
     def get_length(self):
         return self.valobj.GetChildMemberWithName('m_length').GetValueAsUnsigned(0)
 
     def get_data8(self):
-        return self.valobj.GetChildAtIndex(0).GetChildAtIndex(2).GetChildMemberWithName('m_data8')
+        return self.valobj.GetChildAtIndex(2).GetChildMemberWithName('m_data8')
 
     def get_data16(self):
-        return self.valobj.GetChildAtIndex(0).GetChildAtIndex(2).GetChildMemberWithName('m_data16')
+        return self.valobj.GetChildAtIndex(2).GetChildMemberWithName('m_data16')
 
     def to_string(self):
         error = lldb.SBError()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to