Custom pretty printers
In addition to the pre-installed pretty printers you can also use your own GDB pretty printers.
A GDB pretty printer consists of an auto-load
script that is
automatically loaded when a particular executable or shared object is
loaded and the actual pretty printer Python classes themselves. To make
a pretty printer available, copy it to ~/.allinea/gdb
.
Warning
Only install pretty printers from trusted third-party sources.
An example pretty printer can be found in {installation-directory}/examples
.
Compile the fruit
example program using the GNU C++ compiler as shown:
cd {installation-directory}/examples
make -f fruit.makefile
Start Linaro DDT with the example program:
ddt --start {installation-directory}/examples/fruit
When the program has started, right-click on line 20 then use the Run to here command. The
internal variable of myFruit
is displayed on the Locals tab.
Now install the fruit pretty printer by copying the files to ~/.allinea/gdb
:
cp -r {installation-directory}/examples/fruit-pretty-printer/* ~/.allinea/gdb/
Re-run the program and run to line 20, as before. Click on
the Locals tab and you can see that now, instead of the internal variable
myFruit
, the type of fruit is displayed instead.