[llvm] r359157 - [utils] Add a lldb data formatter for llvm::SmallString.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 17:03:03 PDT 2019
Author: davide
Date: Wed Apr 24 17:03:02 2019
New Revision: 359157
URL: http://llvm.org/viewvc/llvm-project?rev=359157&view=rev
Log:
[utils] Add a lldb data formatter for llvm::SmallString.
Result:
(lldb) p val
(llvm::SmallString<32>) $31 = "patatino"
Modified:
llvm/trunk/utils/lldbDataFormatters.py
Modified: llvm/trunk/utils/lldbDataFormatters.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lldbDataFormatters.py?rev=359157&r1=359156&r2=359157&view=diff
==============================================================================
--- llvm/trunk/utils/lldbDataFormatters.py (original)
+++ llvm/trunk/utils/lldbDataFormatters.py Wed Apr 24 17:03:02 2019
@@ -18,6 +18,9 @@ def __lldb_init_module(debugger, interna
debugger.HandleCommand('type summary add -w llvm '
'-F lldbDataFormatters.OptionalSummaryProvider '
'-x "^llvm::Optional<.+>$"')
+ debugger.HandleCommand('type summary add -w llvm '
+ '-F lldbDataFormatters.SmallStringSummaryProvider '
+ '-x "^llvm::SmallString<.+>$"')
# Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl
class SmallVectorSynthProvider:
@@ -104,3 +107,11 @@ def OptionalSummaryProvider(valobj, inte
underlying_type = storage.GetType().GetTemplateArgumentType(0)
storage = storage.GetChildMemberWithName('storage')
return str(storage.Cast(underlying_type))
+
+def SmallStringSummaryProvider(valobj, internal_dict):
+ num_elements = valobj.GetNumChildren()
+ res = "\""
+ for i in range(0, num_elements):
+ res += valobj.GetChildAtIndex(i).GetValue().strip("'")
+ res += "\""
+ return res
More information about the llvm-commits
mailing list