4 def pyobj_summary(value
, unused
):
5 if value
is None or value
.IsValid() == False or value
.GetValueAsUnsigned(0) == 0:
7 refcnt
= value
.GetChildMemberWithName("ob_refcnt")
8 expr
= "(char*)PyString_AsString( (PyObject*)PyObject_Str( (PyObject*)0x%x) )" % (
9 value
.GetValueAsUnsigned(0)
11 expr_summary
= value
.target
.EvaluateExpression(
12 expr
, lldb
.SBExpressionOptions()
14 refcnt_value
= "rc = %d" % (refcnt
.GetValueAsUnsigned(0))
15 return "%s (%s)" % (expr_summary
, refcnt_value
)
18 def __lldb_init_module(debugger
, unused
):
19 debugger
.HandleCommand(
20 "type summary add PyObject --python-function pysummary.pyobj_summary"
22 debugger
.HandleCommand(
23 "type summary add lldb_private::PythonObject -s ${var.m_py_obj%S}"
25 debugger
.HandleCommand(
26 "type summary add lldb_private::PythonDictionary -s ${var.m_py_obj%S}"
28 debugger
.HandleCommand(
29 "type summary add lldb_private::PythonString -s ${var.m_py_obj%S}"