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))
10 expr_summary
= value
.target
.EvaluateExpression(
11 expr
, lldb
.SBExpressionOptions()).GetSummary()
12 refcnt_value
= "rc = %d" % (refcnt
.GetValueAsUnsigned(0))
13 return "%s (%s)" % (expr_summary
, refcnt_value
)
16 def __lldb_init_module(debugger
, unused
):
17 debugger
.HandleCommand(
18 "type summary add PyObject --python-function pysummary.pyobj_summary")
19 debugger
.HandleCommand(
20 "type summary add lldb_private::PythonObject -s ${var.m_py_obj%S}")
21 debugger
.HandleCommand(
22 "type summary add lldb_private::PythonDictionary -s ${var.m_py_obj%S}")
23 debugger
.HandleCommand(
24 "type summary add lldb_private::PythonString -s ${var.m_py_obj%S}")