From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org,
Philippe Waroquiers <philippe.waroquiers@skynet.be>
Subject: Re: [PATCHv2 5/5] gdb: Introduce 'print max-depth' feature
Date: Thu, 18 Apr 2019 21:52:00 -0000 [thread overview]
Message-ID: <20190418215232.GU2737@embecosm.com> (raw)
In-Reply-To: <83o954domk.fsf@gnu.org>
* Eli Zaretskii <eliz@gnu.org> [2019-04-18 05:38:11 +0300]:
> > Date: Thu, 18 Apr 2019 02:07:26 +0100
> > From: Andrew Burgess <andrew.burgess@embecosm.com>
> > Cc: gdb-patches@sourceware.org
> >
> > > "increase ... to increase" sounds awkward and perhaps even confusing.
> > > Can we come up with a better wording?
> >
> > You're right, that doesn't read well, how about simply dropping the
> > '...to increase' like this:
> >
> >
> > +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
>
> Fine with me, thanks.
Eli, thanks for the feedback.
Having taken Philippe's feedback on board too, I have now adjusted how
I show the effects of the different depth settings to use a table
instead of a set of paragraphs.
I just wanted to run this by you to make sure I hadn't made any silly
style mistakes.
The diff below is only for gdb/doc/gdb.texinfo - this is the only file
I've changed over the previous version of the patch.
thanks,
Andrew
--
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index f410d026b82..02e90284494 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -10560,6 +10560,64 @@
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
next prev parent reply other threads:[~2019-04-18 21:52 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 23:06 [PATCHv2 0/5] Add new " Andrew Burgess
2019-03-27 21:53 ` [PATCH 0/2] " Andrew Burgess
2019-03-27 21:53 ` [PATCH 2/2] gdb: Introduce " Andrew Burgess
2019-03-28 16:08 ` Eli Zaretskii
2019-03-27 21:53 ` [PATCH 1/2] gdb: Introduce new language field la_struct_too_deep_ellipsis Andrew Burgess
2019-03-28 12:43 ` Pedro Alves
2019-03-28 12:47 ` [PATCH 0/2] Add new 'print max-depth' feature Pedro Alves
2019-03-28 22:48 ` Andrew Burgess
2019-03-28 23:47 ` Marco Barisione
2019-04-16 23:06 ` [PATCHv2 1/5] gdb/ada: Update some predicate functions to return bool Andrew Burgess
2019-04-18 0:03 ` Joel Brobecker
2019-04-16 23:06 ` [PATCHv2 4/5] gdb: Introduce new language field la_is_string_type_p Andrew Burgess
2019-04-18 17:08 ` Pedro Alves
2019-04-19 21:00 ` Andrew Burgess
2019-04-19 14:45 ` Tom Tromey
2019-04-19 22:22 ` Andrew Burgess
2019-04-24 19:32 ` Tom Tromey
2019-04-19 22:45 ` Andrew Burgess
2019-04-24 19:33 ` Tom Tromey
2019-04-16 23:06 ` [PATCHv2 5/5] gdb: Introduce 'print max-depth' feature Andrew Burgess
2019-04-17 7:42 ` Philippe Waroquiers
2019-04-17 14:35 ` Eli Zaretskii
2019-04-18 1:07 ` Andrew Burgess
2019-04-18 2:38 ` Eli Zaretskii
2019-04-18 21:52 ` Andrew Burgess [this message]
2019-04-19 6:50 ` Eli Zaretskii
2019-04-18 17:08 ` Pedro Alves
2019-04-16 23:06 ` [PATCHv2 3/5] gdb: Introduce new language field la_struct_too_deep_ellipsis Andrew Burgess
2019-04-19 14:37 ` Tom Tromey
2019-04-16 23:06 ` [PATCHv2 2/5] gdb/testsuite: Don't add gcc flags when compiling rust tests Andrew Burgess
2019-04-19 14:31 ` Tom Tromey
2019-04-29 21:14 ` [PATCHv2 0/5] Add new 'print max-depth' feature Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190418215232.GU2737@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox