Bug 129448

Summary: lldb_webkit.py throws exception when generating summary of null StringImpl
Product: WebKit Reporter: BJ Burg <bburg>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, jer.noble, joepeck, mattbaker
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Proposed fix
none
Patch none

Description BJ Burg 2014-02-27 14:10:15 PST
frame #3: 0x0000000100a89e40 JavaScriptCore`WTF::StringImpl::reallocate(originalString=0x00007fff5fbf6020, length=268435456, data=0x00007fff5fbf6950) + 128 at StringImpl.cpp:240
(lldb) frame variable

Traceback (most recent call last):
  File "/Users/bburg/repos/webkit/OpenSource/Tools/lldb/lldb_webkit.py", line 55, in WTFStringImpl_SummaryProvider
    return "{ length = %d, is8bit = %d, contents = '%s' }" % (provider.get_length(), provider.is_8bit(), provider.to_string())
  File "/Users/bburg/repos/webkit/OpenSource/Tools/lldb/lldb_webkit.py", line 175, in to_string
    return ustring_to_string(self.get_data16(), error, self.get_length())
  File "/Users/bburg/repos/webkit/OpenSource/Tools/lldb/lldb_webkit.py", line 131, in ustring_to_string
    contents = valobj.GetProcess().ReadMemory(pointer, length * 2, lldb.SBError())
  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/Python/lldb/__init__.py", line 5709, in ReadMemory
    return _lldb.SBProcess_ReadMemory(self, *args)
ValueError: Positive integer expected
(WTF::PassRefPtr<WTF::StringImpl> &) originalString = 0x00007fff5fbf6020: {
  m_ptr = 0x0000000000000000
}
(unsigned int) length = 268435456
(LChar *&) data = 0x00007fff5fbf6950: {
  &data = 0x000000012ff97024
}
Comment 1 Jer Noble 2014-02-28 09:11:58 PST
Good catch! I'll look into this.
Comment 2 Matt Baker 2014-07-31 14:53:39 PDT
I have a fix, will patch soon.
Comment 3 Matt Baker 2014-07-31 15:09:58 PDT
Created attachment 235849 [details]
Proposed fix
Comment 4 WebKit Commit Bot 2014-07-31 15:11:53 PDT
Attachment 235849 [details] did not pass style-queue:


ERROR: Tools/ChangeLog:8:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Matt Baker 2014-07-31 15:21:51 PDT
Created attachment 235851 [details]
Patch
Comment 6 Jer Noble 2014-07-31 16:27:32 PDT
Comment on attachment 235851 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=235851&action=review

r=me, with nit.

> Tools/lldb/lldb_webkit.py:58
> +        return ""

Nit: it might be nice to return "{ null }" here.
Comment 7 Joseph Pecoraro 2014-07-31 16:45:25 PDT
Comment on attachment 235851 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=235851&action=review

>> Tools/lldb/lldb_webkit.py:58
>> +        return ""
> 
> Nit: it might be nice to return "{ null }" here.

Oh nice! I like that idea.
Comment 8 Matt Baker 2014-07-31 16:56:05 PDT
Comment on attachment 235851 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=235851&action=review

>> Tools/lldb/lldb_webkit.py:58
>> +        return ""
> 
> Nit: it might be nice to return "{ null }" here.

Xcode auto-appends "NULL" in the variables window in this case, so it might just add clutter.
Comment 9 WebKit Commit Bot 2014-08-04 16:06:28 PDT
Comment on attachment 235851 [details]
Patch

Clearing flags on attachment: 235851

Committed r172012: <http://trac.webkit.org/changeset/172012>
Comment 10 WebKit Commit Bot 2014-08-04 16:06:32 PDT
All reviewed patches have been landed.  Closing bug.