public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Handle array- and string-like types in DAP
@ 2023-08-22 15:25 Tom Tromey
  2023-08-22 15:25 ` [PATCH 1/8] Move rust_language::lookup_symbol_nonlocal Tom Tromey
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Tom Tromey @ 2023-08-22 15:25 UTC (permalink / raw)
  To: gdb-patches

A co-worker noticed that some Ada array types did not display properly
via DAP.  Looking into this, I found a couple related problems.

In Ada, some arrays are represented as structures.  The Ada code in
gdb (ada-valprint.c and ada-varobj.c) know how to display these as
arrays, instead.

Also, in Ada, a String is just an array of characters, and again the
Ada code in gdb understands this and displays them more naturally.

Similar cases occur in Rust.

After thinking about this for a while, I decided to try to take a
relatively generic approach to fixing this.  This series adds some
Python API so that Python code can know if a type is "array-like" or
"string-like", and then changes the no-op value-printers to use this
information.

All the tests are deferred until the end of the series.

---
Tom Tromey (8):
      Move rust_language::lookup_symbol_nonlocal
      Refactor Rust code for slice-to-array operation
      Introduce TYPE_SPECIFIC_RUST_STUFF
      Use ada_value_subscript in valpy_getitem
      Introduce type::is_array_like and value_to_array
      Select frame when fetching a frame variable in DAP
      Add new Python APIs to support DAP value display
      Handle array- and string-like values in no-op pretty printers

 gdb/NEWS                                  |   8 ++
 gdb/ada-lang.c                            |   1 +
 gdb/doc/python.texi                       |  24 ++++++
 gdb/dwarf2/read.c                         |   9 ++-
 gdb/gdbtypes.c                            |  24 ++++++
 gdb/gdbtypes.h                            |  16 +++-
 gdb/python/lib/gdb/dap/next.py            |  11 ++-
 gdb/python/lib/gdb/dap/scopes.py          |   4 +
 gdb/python/lib/gdb/printing.py            |  26 ++++++-
 gdb/python/py-type.c                      |  57 ++++++++++++++
 gdb/python/py-value.c                     |  40 ++++++++++
 gdb/rust-lang.c                           |  74 +++++++++++++++---
 gdb/rust-lang.h                           |  39 ++--------
 gdb/testsuite/gdb.dap/ada-arrays.exp      | 123 ++++++++++++++++++++++++++++++
 gdb/testsuite/gdb.dap/ada-arrays/cstuff.c |  22 ++++++
 gdb/testsuite/gdb.dap/ada-arrays/main.adb |  24 ++++++
 gdb/testsuite/gdb.dap/ada-arrays/pck.adb  |  21 +++++
 gdb/testsuite/gdb.dap/ada-arrays/pck.ads  |  51 +++++++++++++
 gdb/testsuite/gdb.dap/rust-slices.exp     | 119 +++++++++++++++++++++++++++++
 gdb/testsuite/gdb.dap/rust-slices.rs      |  29 +++++++
 gdb/valarith.c                            |  21 +++++
 gdb/value.h                               |   4 +
 22 files changed, 699 insertions(+), 48 deletions(-)
---
base-commit: 8032f75b2994816e87e9d2ab7c46ad86601c999b
change-id: 20230822-array-and-string-like-f2a941d78802

Best regards,
-- 
Tom Tromey <tromey@adacore.com>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-09-05 17:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22 15:25 [PATCH 0/8] Handle array- and string-like types in DAP Tom Tromey
2023-08-22 15:25 ` [PATCH 1/8] Move rust_language::lookup_symbol_nonlocal Tom Tromey
2023-08-22 15:25 ` [PATCH 2/8] Refactor Rust code for slice-to-array operation Tom Tromey
2023-08-22 15:25 ` [PATCH 3/8] Introduce TYPE_SPECIFIC_RUST_STUFF Tom Tromey
2023-08-22 15:25 ` [PATCH 4/8] Use ada_value_subscript in valpy_getitem Tom Tromey
2023-08-22 15:25 ` [PATCH 5/8] Introduce type::is_array_like and value_to_array Tom Tromey
2023-08-22 15:25 ` [PATCH 6/8] Select frame when fetching a frame variable in DAP Tom Tromey
2023-08-22 15:25 ` [PATCH 7/8] Add new Python APIs to support DAP value display Tom Tromey
2023-08-22 15:46   ` Eli Zaretskii
2023-08-22 15:25 ` [PATCH 8/8] Handle array- and string-like values in no-op pretty printers Tom Tromey
2023-09-05 17:22 ` [PATCH 0/8] Handle array- and string-like types in DAP Tom Tromey

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).