mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-24 12:20:00 +00:00
[utils] Add a lldb data formatter for llvm::SmallString.
Result: (lldb) p val (llvm::SmallString<32>) $31 = "patatino" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359157 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
020519ba5c
commit
da7391081a
@ -18,6 +18,9 @@ def __lldb_init_module(debugger, internal_dict):
|
|||||||
debugger.HandleCommand('type summary add -w llvm '
|
debugger.HandleCommand('type summary add -w llvm '
|
||||||
'-F lldbDataFormatters.OptionalSummaryProvider '
|
'-F lldbDataFormatters.OptionalSummaryProvider '
|
||||||
'-x "^llvm::Optional<.+>$"')
|
'-x "^llvm::Optional<.+>$"')
|
||||||
|
debugger.HandleCommand('type summary add -w llvm '
|
||||||
|
'-F lldbDataFormatters.SmallStringSummaryProvider '
|
||||||
|
'-x "^llvm::SmallString<.+>$"')
|
||||||
|
|
||||||
# Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl
|
# Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl
|
||||||
class SmallVectorSynthProvider:
|
class SmallVectorSynthProvider:
|
||||||
@ -104,3 +107,11 @@ def OptionalSummaryProvider(valobj, internal_dict):
|
|||||||
underlying_type = storage.GetType().GetTemplateArgumentType(0)
|
underlying_type = storage.GetType().GetTemplateArgumentType(0)
|
||||||
storage = storage.GetChildMemberWithName('storage')
|
storage = storage.GetChildMemberWithName('storage')
|
||||||
return str(storage.Cast(underlying_type))
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user