diff options
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 58 | ||||
-rw-r--r-- | gdb/doc/guile.texi | 3 | ||||
-rw-r--r-- | gdb/doc/python.texi | 8 |
4 files changed, 77 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 3efed67..4166f19 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,11 @@ +2019-04-29 Andrew Burgess <andrew.burgess@embecosm.com> + + * gdb.texinfo (Print Settings): Document 'print max-depth'. + * guile.texi (Guile Pretty Printing API): Document that 'print + max-depth' can effect the display of a values children. + * python.texi (Pretty Printing API): Likewise. + (Values From Inferior): Document max_depth keyword. + 2019-04-27 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Calling): Document the new diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index cf8333d..2282c80 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -10572,6 +10572,64 @@ is 10. Display the current threshold for printing repeated identical elements. +@item set print max-depth @var{depth} +@item set print max-depth unlimited +@cindex printing nested structures +Set the threshold after which nested structures are replaced with +ellipsis, this can make visualising deeply nested structures easier. + +For example, given this C code + +@smallexample +typedef struct s1 @{ int a; @} s1; +typedef struct s2 @{ s1 b; @} s2; +typedef struct s3 @{ s2 c; @} s3; +typedef struct s4 @{ s3 d; @} s4; + +s4 var = @{ @{ @{ @{ 3 @} @} @} @}; +@end smallexample + +The following table shows how different values of @var{depth} will +effect how @code{var} is printed by @value{GDBN}: + +@multitable @columnfractions .3 .7 +@headitem @var{depth} setting @tab Result of @samp{p var} +@item unlimited +@tab @code{$1 = @{d = @{c = @{b = @{a = 3@}@}@}@}} +@item @code{0} +@tab @code{$1 = @{...@}} +@item @code{1} +@tab @code{$1 = @{d = @{...@}@}} +@item @code{2} +@tab @code{$1 = @{d = @{c = @{...@}@}@}} +@item @code{3} +@tab @code{$1 = @{d = @{c = @{b = @{...@}@}@}@}} +@item @code{4} +@tab @code{$1 = @{d = @{c = @{b = @{a = 3@}@}@}@}} +@end multitable + +To see the contents of structures that have been hidden the user can +either increase the print max-depth, or they can print the elements of +the structure that are visible, for example + +@smallexample +(gdb) set print max-depth 2 +(gdb) p var +$1 = @{d = @{c = @{...@}@}@} +(gdb) p var.d +$2 = @{c = @{b = @{...@}@}@} +(gdb) p var.d.c +$3 = @{b = @{a = 3@}@} +@end smallexample + +The pattern used to replace nested structures varies based on +language, for most languages @code{@{...@}} is used, but Fortran uses +@code{(...)}. + +@item show print max-depth +Display the current threshold after which nested structures are +replaces with ellipsis. + @item set print null-stop @cindex @sc{null} elements in arrays Cause @value{GDBN} to stop printing the characters of an array when the first diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi index 721338b..f4c29dc 100644 --- a/gdb/doc/guile.texi +++ b/gdb/doc/guile.texi @@ -1469,6 +1469,9 @@ object which is convertible to a @value{GDBN} value. If @var{children} is @code{#f}, @value{GDBN} will act as though the value has no children. + +Children may be hidden from display based on the value of @samp{set +print max-depth} (@pxref{Print Settings}). @end table @end deffn diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 36947de..b47c38d 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -931,6 +931,11 @@ Number of array elements to print, or @code{0} to print an unlimited number of elements (see @code{set print elements} in @ref{Print Settings}). +@item max_depth +The maximum depth to print for nested structs and unions, or @code{-1} +to print an unlimited number of elements (see @code{set print +max-depth} in @ref{Print Settings}). + @item repeat_threshold Set the threshold for suppressing display of repeated array elements, or @code{0} to represent all elements, even if repeated. (See @code{set @@ -1365,6 +1370,9 @@ object which is convertible to a @value{GDBN} value. This method is optional. If it does not exist, @value{GDBN} will act as though the value has no children. + +Children may be hidden from display based on the value of @samp{set +print max-depth} (@pxref{Print Settings}). @end defun @defun pretty_printer.display_hint (self) |