Node: Debugging Tools, Next: , Previous: Identity Function, Up: Miscellaneous Features

Debugging Tools

Lpp provides debugging tools, primarily to make it easier to debug programs using Lpp in run time debuggers like gdb (Gnu Debugger).

pdb object Function

pdc object Function

ppdb object Function

These functions can be used in a debugger to print and inspect Lpp objects. Each takes one argument object which is any Lpp object or 0 (note that 0 prints as nil). The names of these functions have been kept short for easy typing in a debugger. In some debuggers such as gdb they can be evoked from a user defined macro which gives even more brevity. pdb uses prin1, pdc uses princ and ppdb uses pprint. For example assume we are debugging the following code in gdb

     let list1 = list(L("One"), L(2), S(Three));
     findJunk(first(list1));         // <--- Assume breakpoint here

and assume that we had placed a breakpoint at the findJunk call. Then after running and catching the breakpoint in gdb

     (gdb) p pdb(list1)
     ("One" 2 Three)
     (gdb) p pdb(car(list1))
     (gdb) p pdc(car(list1))

Note the difference between the pdb and pdc printing of the String "One", the pdb version is quoted and the pdc version is not. This reflects the standard Common Lisp difference between the way that Lisp objects such as strings print using princ versus print1. However the Lpp user is free to capitalize on this for his own objects for example by having one print method for standard C++ stream output (princ) and another for debugging inspection purposes. And since print methods can be set dynamically in the object's type meta-object the user can have any number of ways to print an object depending on the setting, See Accessing Type Meta-Objects.