gdb: Pretty-Printer Commands
10.9.3 Pretty-Printer Commands
------------------------------
'info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
Print the list of installed pretty-printers. This includes
disabled pretty-printers, which are marked as such.
OBJECT-REGEXP is a regular expression matching the objects whose
pretty-printers to list. Objects can be 'global', the program
space's file (Progspaces In Python), and the object files
DONTPRINTYET within that program space (Objfiles In Python). *NoteDONTPRINTYET within that program space (Objfiles In Python).
Selecting Pretty-Printers, for details on how GDB looks up a
printer from these three objects.
NAME-REGEXP is a regular expression matching the name of the
printers to list.
'disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
Disable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP. A
disabled pretty-printer is not forgotten, it may be enabled again
later.
'enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]'
Enable pretty-printers matching OBJECT-REGEXP and NAME-REGEXP.
Example:
Suppose we have three pretty-printers installed: one from library1.so
named 'foo' that prints objects of type 'foo', and another from
library2.so named 'bar' that prints two types of objects, 'bar1' and
'bar2'.
(gdb) info pretty-printer
library1.so:
foo
library2.so:
bar
bar1
bar2
(gdb) info pretty-printer library2
library2.so:
bar
bar1
bar2
(gdb) disable pretty-printer library1
1 printer disabled
2 of 3 printers enabled
(gdb) info pretty-printer
library1.so:
foo [disabled]
library2.so:
bar
bar1
bar2
(gdb) disable pretty-printer library2 bar;bar1
1 printer disabled
1 of 3 printers enabled
(gdb) info pretty-printer library2
library1.so:
foo [disabled]
library2.so:
bar
bar1 [disabled]
bar2
(gdb) disable pretty-printer library2 bar
1 printer disabled
0 of 3 printers enabled
(gdb) info pretty-printer library2
library1.so:
foo [disabled]
library2.so:
bar [disabled]
bar1 [disabled]
bar2
Note that for 'bar' the entire printer can be disabled, as can each
individual subprinter.