dbx now has a mechanism in which you can write pretty-printing filters in Python. The pretty-printing filters transform a Value to a more readable form in dbx.
On the dbx command line, you can enable pretty-printing by using the –p option for the print, display, and watch commands or by typing dbxenv output_pretty_print on. In the IDE and dbxtool, you can enable pretty-printing by setting your dbxenv variable output_pretty_print to on and you can use the Pretty Print checkbox in the context menu of the Watches and Variables windows.
Filters are built in for select classes in 4 implementations of the C++ Standard Template Library. The following table specifies the library name and the compiler option for that library:
|
The following table specifies which classes filters can be used for in the C++ Standard Template Library and if index and slice can be printed:
|
The following output is an example of printing a list using the print command in dbx:
(dbx) print list10 list10 = { __buffer_size = 32U __buffer_list = { __data_ = 0x654a8 } __free_list = (nil) __next_avail = 0x67334 __last = 0x67448 __node = 0x48830 __length = 10U }
The following is the same list printed in dbx, but using pretty-printing filters:
(dbx) print -p list10 list10 = (200, 201, 202, 203, 204, 205, 206, 207, 208, 209) (dbx) print -p list10[5] list10[5] = 205 (dbx) print -p list10[1..100:2] list10[1..100:2] = [1] = 202 [3] = 204 [5] = 206 [7] = 208
For general information about pretty-printing and call-style pretty-printers see Using Pretty-Printing in Oracle Solaris Studio 12.4: Debugging a Program With dbx and the topic prettyprint in the dbx helpfile.