20 """GDB commands for working with type-printers."""
23 """GDB command to list all registered type-printers.
25 Usage: info type-printers
29 super(InfoTypePrinter, self).
__init__(
"info type-printers",
33 """Print a list of type printers."""
36 sorted_type_printers = sorted (copy.copy(type_printers),
37 key =
lambda x: x.name)
38 for printer
in sorted_type_printers:
42 enabled =
" [disabled]"
43 print (
" %s%s" % (printer.name, enabled))
46 """GDB calls this to perform the command."""
48 for objfile
in gdb.objfiles():
49 if objfile.type_printers:
50 print (
"%sType printers for %s:" % (sep, objfile.filename))
53 if gdb.current_progspace().type_printers:
54 print (
"%sType printers for program space:" % sep)
58 print (
"%sGlobal type printers:" % sep)
63 super(_EnableOrDisableCommand, self).
__init__(name, gdb.COMMAND_DATA)
75 """GDB calls this to perform the command."""
76 for name
in arg.split():
78 for objfile
in gdb.objfiles():
79 if self.
set_some(name, objfile.type_printers):
81 if self.
set_some(name, gdb.current_progspace().type_printers):
83 if self.
set_some(name, gdb.type_printers):
86 print (
"No type printer named '%s'" % name)
90 if p.name.startswith(word):
95 for objfile
in gdb.objfiles():
96 self.
add_some(result, word, objfile.type_printers)
97 self.
add_some(result, word, gdb.current_progspace().type_printers)
98 self.
add_some(result, word, gdb.type_printers)
102 """GDB command to enable the specified type printer.
104 Usage: enable type-printer NAME
106 NAME is the name of the type-printer.
110 super(EnableTypePrinter, self).
__init__(
True,
"enable type-printer")
113 """GDB command to disable the specified type-printer.
115 Usage: disable type-printer NAME
117 NAME is the name of the type-printer.
121 super(DisableTypePrinter, self).
__init__(
False,
"disable type-printer")
def invoke(self, arg, from_tty)
def __init__(self, setting, name)
def complete(self, text, word)
def list_type_printers(self, type_printers)
def set_some(self, name, printers)
def invoke(self, arg, from_tty)
def add_some(self, result, word, printers)