[PATCH] D66354: Add LLDB dataformatters for llvm::StringRef and lldb_private::ConstString
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 16:46:57 PDT 2019
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369175: Add LLDB dataformatters for llvm::StringRef and lldb_private::ConstString (authored by adrian, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D66354?vs=215627&id=215721#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66354/new/
https://reviews.llvm.org/D66354
Files:
llvm/trunk/utils/lldbDataFormatters.py
Index: llvm/trunk/utils/lldbDataFormatters.py
===================================================================
--- llvm/trunk/utils/lldbDataFormatters.py
+++ llvm/trunk/utils/lldbDataFormatters.py
@@ -21,6 +21,12 @@
debugger.HandleCommand('type summary add -w llvm '
'-F lldbDataFormatters.SmallStringSummaryProvider '
'-x "^llvm::SmallString<.+>$"')
+ debugger.HandleCommand('type summary add -w llvm '
+ '-F lldbDataFormatters.StringRefSummaryProvider '
+ '-x "^llvm::StringRef$"')
+ debugger.HandleCommand('type summary add -w llvm '
+ '-F lldbDataFormatters.ConstStringSummaryProvider '
+ '-x "^lldb_private::ConstString$"')
# Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl
class SmallVectorSynthProvider:
@@ -115,3 +121,20 @@
res += valobj.GetChildAtIndex(i).GetValue().strip("'")
res += "\""
return res
+
+def StringRefSummaryProvider(valobj, internal_dict):
+ if valobj.GetNumChildren() == 2:
+ # StringRef's are also used to point at binary blobs in memory,
+ # so filter out suspiciously long strings.
+ max_length = 256
+ length = valobj.GetChildAtIndex(1).GetValueAsUnsigned(max_length)
+ if length == 0:
+ return "NULL"
+ if length < max_length:
+ return valobj.GetChildAtIndex(0).GetSummary()
+ return ""
+
+def ConstStringSummaryProvider(valobj, internal_dict):
+ if valobj.GetNumChildren() == 1:
+ return valobj.GetChildAtIndex(0).GetSummary()
+ return ""
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66354.215721.patch
Type: text/x-patch
Size: 1661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190816/b28c37bb/attachment.bin>
More information about the llvm-commits
mailing list