public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Maciej W. Rozycki" <macro@embecosm.com>
Cc: gdb-patches@sourceware.org, aburgess@redhat.com, tom@tromey.com,
	Richard.Bunt@arm.com
Subject: Re: [PATCH v3 5/5] GDB: Introduce limited array lengths while printing values
Date: Tue, 24 Jan 2023 14:59:12 +0200	[thread overview]
Message-ID: <83v8kwgkbj.fsf@gnu.org> (raw)
In-Reply-To: <alpine.DEB.2.20.2301211719580.7841@tpp.orcam.me.uk> (macro@embecosm.com)

> Date: Mon, 23 Jan 2023 23:14:35 +0000 (GMT)
> From: "Maciej W. Rozycki" <macro@embecosm.com>
> cc: Andrew Burgess <aburgess@redhat.com>, Tom Tromey <tom@tromey.com>, 
>  Richard Bunt <Richard.Bunt@arm.com>
> 
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> 
> This commit introduces the idea of loading only part of an array in 
> order to print it, what I call "limited length" arrays.
> 
> The motivation behind this work is to make it possible to print slices 
> of very large arrays, where very large means bigger than 
> `max-value-size'.
> 
> Consider this GDB session with the current GDB:
> 
>   (gdb) set max-value-size 100
>   (gdb) p large_1d_array
>   value requires 400 bytes, which is more than max-value-size
>   (gdb) p -elements 10 -- large_1d_array
>   value requires 400 bytes, which is more than max-value-size
> 
> notice that the request to print 10 elements still fails, even though 10 
> elements should be less than the max-value-size.  With a patched version 
> of GDB:
> 
>   (gdb) p -elements 10 -- large_1d_array
>   $1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9...}
> 
> So now the print has succeeded.  It also has loaded `max-value-size' 
> worth of data into value history, so the recorded value can be accessed 
> consistently:
> 
>   (gdb) p -elements 10 -- $1
>   $2 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9...}
>   (gdb) p $1
>   $3 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
>     20, 21, 22, 23, 24, <unavailable> <repeats 75 times>}
>   (gdb)
> 
> Accesses with other languages work similarly, although for Ada only 
> C-style [] array element/dimension accesses use history.  For both Ada 
> and Fortran () array element/dimension accesses go straight to the 
> inferior, bypassing the value history just as with C pointers.
> 
> Co-Authored-By: Maciej W. Rozycki <macro@embecosm.com>
> ---
> Changes from v2:
> 
> - Adjust for the `value_copy' update in 1/5.
> 
> - Remove the handling of (dst_len != src_len) in `value_copy' where
>   `dst_len' is always the same as `src_len' (from the corresponding 
>   settings in `val' assigned to from `arg' right beforehand).
> 
> - Switch Ada and Fortran test cases to using `allow_ada_tests' and 
>   `allow_fortran_tests' respectively.
> 
> - Fix a couple of formatting issues involving spaces used instead of tabs.
> 
> Changes from v1:
> 
> - Load `max-value-size' worth data into the value history for limited 
>   length accesses and mark the area beyond unavailable.
> 
> - Handle the `output' command.
> 
> - Expand test coverage.
> ---
>  gdb/NEWS                                     |    6 
>  gdb/doc/gdb.texinfo                          |    9 
>  gdb/f-valprint.c                             |   32 ++-
>  gdb/printcmd.c                               |   16 +
>  gdb/testsuite/gdb.ada/limited-length.exp     |  264 +++++++++++++++++++++++++++
>  gdb/testsuite/gdb.ada/limited-length/foo.adb |   37 +++
>  gdb/testsuite/gdb.ada/limited-length/pck.adb |   25 ++
>  gdb/testsuite/gdb.ada/limited-length/pck.ads |   21 ++
>  gdb/testsuite/gdb.base/limited-length.c      |   48 ++++
>  gdb/testsuite/gdb.base/limited-length.exp    |  242 ++++++++++++++++++++++++
>  gdb/testsuite/gdb.fortran/limited-length.exp |  220 ++++++++++++++++++++++
>  gdb/testsuite/gdb.fortran/limited-length.f90 |   39 +++
>  gdb/valprint.c                               |   10 -
>  gdb/value.c                                  |  186 +++++++++++++++++--
>  gdb/value.h                                  |   17 +
>  15 files changed, 1147 insertions(+), 25 deletions(-)
>  create mode 100644 gdb/testsuite/gdb.ada/limited-length.exp
>  create mode 100644 gdb/testsuite/gdb.ada/limited-length/foo.adb
>  create mode 100644 gdb/testsuite/gdb.ada/limited-length/pck.adb
>  create mode 100644 gdb/testsuite/gdb.ada/limited-length/pck.ads
>  create mode 100644 gdb/testsuite/gdb.base/limited-length.c
>  create mode 100644 gdb/testsuite/gdb.base/limited-length.exp
>  create mode 100644 gdb/testsuite/gdb.fortran/limited-length.exp
>  create mode 100644 gdb/testsuite/gdb.fortran/limited-length.f90

Thanks, the documentation parts are OK.

  reply	other threads:[~2023-01-24 12:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 23:00 [PATCH v3 0/5] gdb: introduce " Maciej W. Rozycki
2023-01-23 23:13 ` [PATCH v3 1/5] GDB: Ignore `max-value-size' setting with value history accesses Maciej W. Rozycki
2023-01-31 17:58   ` Tom Tromey
2023-02-10 14:17     ` Maciej W. Rozycki
2023-01-23 23:13 ` [PATCH v3 2/5] GDB: Fix the mess with value byte/bit range types Maciej W. Rozycki
2023-01-31 18:09   ` Tom Tromey
2023-02-10 14:18     ` Maciej W. Rozycki
2023-02-10 14:49       ` Tom Tromey
2023-01-23 23:14 ` [PATCH v3 3/5] GDB: Only make data actually retrieved into value history available Maciej W. Rozycki
2023-01-31 18:47   ` Tom Tromey
2023-02-10 14:18     ` Maciej W. Rozycki
2023-02-10 21:11       ` Tom Tromey
2023-01-23 23:14 ` [PATCH v3 4/5] GDB/testsuite: Add `-nonl' option to `gdb_test' Maciej W. Rozycki
2023-01-31 19:02   ` Tom Tromey
2023-01-23 23:14 ` [PATCH v3 5/5] GDB: Introduce limited array lengths while printing values Maciej W. Rozycki
2023-01-24 12:59   ` Eli Zaretskii [this message]
2023-01-31 20:49   ` Tom Tromey
2023-02-10 14:18     ` Maciej W. Rozycki

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=83v8kwgkbj.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=Richard.Bunt@arm.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@embecosm.com \
    --cc=tom@tromey.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).