30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
import lldb
|
|
|
|
def __lldb_init_module(debugger, internal_dict):
|
|
# 为你的类添加摘要
|
|
debugger.HandleCommand('type summary add -x "dl::PointU" -F custom_printers.PointU_summary')
|
|
debugger.HandleCommand('type summary add -x "dl::Point" -F custom_printers.Point_summary')
|
|
debugger.HandleCommand('type summary add -x "dl::Position" -F custom_printers.Position_summary')
|
|
debugger.HandleCommand('type summary add -x "dl::Point4" -F custom_printers.Point4_summary')
|
|
|
|
def PointU_summary(valobj, internal_dict):
|
|
x = valobj.GetChildMemberWithName('x').GetValueAsUnsigned()
|
|
y = valobj.GetChildMemberWithName('y').GetValueAsUnsigned()
|
|
return f'PointU: {x, y}'
|
|
|
|
def Point_summary(valobj, internal_dict):
|
|
x = valobj.GetChildMemberWithName('x').GetValueAsUnsigned()
|
|
y = valobj.GetChildMemberWithName('y').GetValueAsUnsigned()
|
|
return f'Point: {x, y}'
|
|
|
|
def Position_summary(valobj, internal_dict):
|
|
x = valobj.GetChildMemberWithName('x').GetValue()
|
|
y = valobj.GetChildMemberWithName('y').GetValue()
|
|
return f'Position: {x, y}'
|
|
|
|
def Point4_summary(valobj, internal_dict):
|
|
x = valobj.GetChildMemberWithName('x').GetValue()
|
|
y = valobj.GetChildMemberWithName('y').GetValue()
|
|
z = valobj.GetChildMemberWithName('z').GetValue()
|
|
w = valobj.GetChildMemberWithName('w').GetValue()
|
|
return f'Point4: {x, y, z, w}' |