Add LLDB visualization support for sk_sp<>.

Change-Id: Ib783712978bea7fbae5d9e454bc3bd5e198c8504
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306939
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2020-07-30 15:59:58 -04:00 committed by Skia Commit-Bot
parent 958a3bb670
commit b61b2bc43b

View File

@ -127,9 +127,37 @@ class SkAutoTArray_SynthProvider:
return True return True
class sk_sp_SynthProvider:
def __init__(self, valobj, dict):
self.valobj = valobj
def num_children(self):
return self.fPtr.GetNumChildren()
def get_child_at_index(self, index):
try:
return self.fPtr.GetChildAtIndex(index)
except:
return None
def get_child_index(self, name):
return self.fPtr.GetIndexOfChildWithName(name)
def update(self):
try:
self.fPtr = self.valobj.GetChildMemberWithName('fPtr')
except:
pass
def __lldb_init_module(debugger, dict): def __lldb_init_module(debugger, dict):
debugger.HandleCommand( debugger.HandleCommand(
'type summary add -F skia.SkString_SummaryProvider "SkString" -w skia') 'type summary add -F skia.SkString_SummaryProvider "SkString" -w skia')
debugger.HandleCommand(
'type synthetic add -l skia.sk_sp_SynthProvider -x "^sk_sp<.+>$" -w skia')
debugger.HandleCommand(
'type summary add --summary-string "fPtr = ${var.fPtr}" -x "^sk_sp<.+>$" -w skia')
debugger.HandleCommand( debugger.HandleCommand(
'type synthetic add -l skia.SkTArray_SynthProvider -x "^SkS?TArray<.+>$" -w skia') 'type synthetic add -l skia.SkTArray_SynthProvider -x "^SkS?TArray<.+>$" -w skia')
debugger.HandleCommand( debugger.HandleCommand(