sssd_gdb_plugin.py revision 942edc402f4acc3de4dc3ec15a89d31d9f206cf6
# SSSD and LDB debugging plugins
#
# Activate them by putting:
# to your .gdbinit file
#
# To bypass the pretty printer and print the raw values, use the "/r" option:
# print /r foobar
import gdb
def gdb_printer_decorator(fn):
return fn
def indent_string(s, indent):
class StringPrinter(object):
"Shared code between different string-printing classes"
class LdbDnPrinter(StringPrinter):
" print an ldb dn "
class LdbValPrinter(StringPrinter):
" print a ldb value"
" print a ldb message element "
ret = "flags = %(flags)s, name = %(name)s, " \
try:
except ValueError:
return "num_values is not numeric?"
class LdbMessagePrinter(StringPrinter):
" print a ldb message "
try:
except ValueError:
return "num_elements is not numeric?"
class LdbResultPrinter(StringPrinter):
" print a ldb message element "
ret = "count = %(count)s, extended = %(extended)s, " \
try:
except ValueError:
ret += 'Count is not numeric value?'
return ret
class SysdbAttrsPrinter(StringPrinter):
" print a struct sysdb attrs "
try:
except ValueError:
ret += 'num is not numeric value?'
return ret
# ---
# --- register pretty printers ---
# ---
def ldb_val_element_printer(val):
return LdbDnPrinter(val)
return None
def ldb_val_element_printer(val):
return LdbValPrinter(val)
return None
return LdbMessageElementPrinter(val)
return None
def ldb_message_printer(val):
return LdbMessagePrinter(val)
return None
def ldb_result_printer(val):
return LdbResultPrinter(val)
return None
def sysdb_attrs_printer(val):
return SysdbAttrsPrinter(val)
return None
# ---
# --- set a breakpoint at the tevent_req finish fn ---
# ---
"""Break at the tevent finish location """
print('cannot determine the type of the variable')
return
print('wrong attribute - must be a tevent_req pointer')
return
try:
except KeyError:
print("No async function defined?")
return
try:
except IndexError:
print("Cannot get function address")
return