public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 00/55] Remove val_print
@ 2019-12-08 18:30 Tom Tromey
  2019-12-08 18:30 ` [PATCH 41/55] Introduce c_value_print_int Tom Tromey
                   ` (55 more replies)
  0 siblings, 56 replies; 76+ messages in thread
From: Tom Tromey @ 2019-12-08 18:30 UTC (permalink / raw)
  To: gdb-patches

I've long wanted to remove the val_print API.  It is used for the
lowest level of value printing, and works by passing around an
"exploded" value -- the type, offset, content, and address are passed
as separate parameters.  However, at some point we also had to start
passing around the original outer-most value as well (to check content
validity), which made the entire exercise a bit of a travesty.

I had put off this refactoring because I couldn't think of a
reviewable way to do it.  However, recently I realized I could
temporarily duplicate a lot of the code, rewriting as it made sense,
and then at the end flip a switch to enable the new paths, while
deleting the old API.  This is the approach taken by this series.

This is mildly ugly in two ways.

First, it duplicates code.  Of course, this is temporary, because the
duplication is entirely removed in the final patch.  So, I don't
consider it a big deal.

Second, there are some spots in the middle of this series that
introduce some regressions.  I tried to prevent this, but it turned
out to be difficult to do.  I am hoping that others agree with me that
this is ok in this case; but if not I can try again.

Patch #3 might not strictly be required.  It exists to preserve the
output in one particular case, but it's not clear if this is intended
behavior or just a historical accident.

It's possible that this series could result in too much memory
allocation when printing very large objects.  If this is a problem, I
think it's possible to implement content sharing in struct value --
one of the nice things about C++ is that it makes this sort of thing
more practical.

While this series eliminates most of the val_print code, a few
vestiges remain.  Some low-level printing routines for particular
types still accept old-style parameters.  This could be cleaned up,
but I haven't done so because this series is already too long.

There's a lot of duplication in the value-printing code.  For example,
the Pascal code seems to be a cut-and-paste of the C++ code; I doubt
(but don't really know) whether Pascal even has virtual base classes
to worry about.  So, another possible future direction would be to
share even more of this code across languages.

Regression tested by the buildbot.  I don't propose checking this in
until after the 9.1 branch has been made.

Let me know what you think.

Tom


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

end of thread, other threads:[~2020-03-14  9:18 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-08 18:30 [PATCH 00/55] Remove val_print Tom Tromey
2019-12-08 18:30 ` [PATCH 41/55] Introduce c_value_print_int Tom Tromey
2019-12-08 18:30 ` [PATCH 11/55] Introduce generic_value_print Tom Tromey
2019-12-09  4:05   ` Christian Biesinger via gdb-patches
2019-12-09 23:40     ` Tom Tromey
2019-12-08 18:30 ` [PATCH 09/55] Use common_val_print in c-valprint.c Tom Tromey
2020-01-15  5:09   ` Simon Marchi
2020-01-24  1:03     ` Tom Tromey
2020-03-14  9:18       ` [committted][gdb/testsuite] Fix FAIL in gdb.base/printcmds.exp Tom de Vries
2019-12-08 18:30 ` [PATCH 30/55] Introduce generic_value_print_ptr Tom Tromey
2019-12-08 18:30 ` [PATCH 13/55] Two simple uses of value_print_scalar_formatted Tom Tromey
2019-12-08 18:30 ` [PATCH 25/55] Convert Modula-2 printing to value-based API Tom Tromey
2019-12-08 18:30 ` [PATCH 35/55] Introduce generic_value_print_int Tom Tromey
2019-12-08 18:30 ` [PATCH 10/55] Introduce la_value_print_inner Tom Tromey
2019-12-08 18:30 ` [PATCH 07/55] Use common_val_print in f-valprint.c Tom Tromey
2019-12-08 18:30 ` [PATCH 19/55] Introduce pascal_value_print_inner Tom Tromey
2019-12-08 18:30 ` [PATCH 24/55] Convert D printing to value-based API Tom Tromey
2019-12-08 18:30 ` [PATCH 48/55] Rewrite ada_value_print_1 floating point case Tom Tromey
2019-12-08 18:30 ` [PATCH 16/55] Make pascal_object_print_value_fields static Tom Tromey
2019-12-08 18:30 ` [PATCH 06/55] Use common_val_print in riscv-tdep.c Tom Tromey
2019-12-08 18:30 ` [PATCH 04/55] Use common_val_print in infcmd.c Tom Tromey
2019-12-08 18:30 ` [PATCH 20/55] Introduce f_value_print_innner Tom Tromey
2019-12-08 18:30 ` [PATCH 22/55] Convert Rust printing to value-based API Tom Tromey
2019-12-08 18:30 ` [PATCH 32/55] Remove generic_val_print_flags Tom Tromey
2019-12-08 18:31 ` [PATCH 42/55] Introduce c_value_print_memberptr Tom Tromey
2019-12-08 18:31 ` [PATCH 14/55] Introduce value_print_array_elements Tom Tromey
2020-01-15  5:47   ` Simon Marchi
2020-01-23 23:39     ` Tom Tromey
2019-12-08 18:31 ` [PATCH 18/55] Introduce m2_value_print_inner Tom Tromey
2019-12-08 18:31 ` [PATCH 05/55] Use common_val_print in mi-main.c Tom Tromey
2019-12-08 18:31 ` [PATCH 33/55] Simplify generic_val_print_func Tom Tromey
2019-12-08 18:31 ` [PATCH 26/55] Convert Fortran printing to value-based API Tom Tromey
2019-12-08 18:31 ` [PATCH 02/55] Refactor val_print and common_val_print Tom Tromey
2019-12-08 18:31 ` [PATCH 03/55] Introduce common_val_print_checked Tom Tromey
2019-12-09  4:06   ` Christian Biesinger via gdb-patches
2019-12-09 23:37     ` Tom Tromey
2019-12-08 18:31 ` [PATCH 46/55] Rewrite ada_value_print_inner Tom Tromey
2019-12-08 18:31 ` [PATCH 29/55] Initial rewrite of generic_value_print Tom Tromey
2019-12-08 18:31 ` [PATCH 38/55] Introduce generic_value_print_complex Tom Tromey
2019-12-08 18:31 ` [PATCH 34/55] Introduce generic_value_print_bool Tom Tromey
2019-12-08 18:32 ` [PATCH 40/55] Introduce c_value_print_ptr Tom Tromey
2020-01-15  6:01   ` Simon Marchi
2020-01-23 23:47     ` Tom Tromey
2019-12-08 18:32 ` [PATCH 01/55] Use scoped_value_mark in value_print Tom Tromey
2019-12-08 18:32 ` [PATCH 54/55] Change extension language pretty-printers to use value API Tom Tromey
2019-12-08 18:32 ` [PATCH 51/55] Convert ada_value_print to value-based API Tom Tromey
2019-12-08 18:32 ` [PATCH 15/55] Simplify c_val_print_array Tom Tromey
2019-12-08 18:32 ` [PATCH 39/55] Rewrite c_value_print_inner Tom Tromey
2019-12-08 18:32 ` [PATCH 23/55] Convert Go printing to value-based API Tom Tromey
2019-12-08 18:32 ` [PATCH 12/55] Introduce value_print_scalar_formatted Tom Tromey
2020-01-15  5:15   ` Simon Marchi
2020-01-23 23:37     ` Tom Tromey
2019-12-08 18:32 ` [PATCH 52/55] Introduce ada_value_print_array Tom Tromey
2019-12-08 18:32 ` [PATCH 43/55] Introduce c_value_print_array Tom Tromey
2019-12-08 18:32 ` [PATCH 28/55] Convert Pascal to value-based API Tom Tromey
2020-01-15  5:57   ` Simon Marchi
2020-01-23 23:41     ` Tom Tromey
2019-12-08 18:32 ` [PATCH 08/55] Use common_val_print in cp-valprint.c Tom Tromey
2019-12-08 18:32 ` [PATCH 44/55] Introduce cp_print_value_fields and c_value_print_struct Tom Tromey
2020-01-15  6:15   ` Simon Marchi
2020-01-24  0:54     ` Tom Tromey
2019-12-08 18:32 ` [PATCH 27/55] Rewrite pascal_value_print_inner Tom Tromey
2019-12-08 18:50 ` [PATCH 55/55] Remove val_print Tom Tromey
2019-12-08 18:51 ` [PATCH 50/55] Convert ada_val_print_ref to value-based API Tom Tromey
2019-12-08 18:51 ` [PATCH 21/55] Introduce ada_value_print_inner Tom Tromey
2019-12-08 18:51 ` [PATCH 53/55] Change print_field_values to use value-based API Tom Tromey
2019-12-08 18:51 ` [PATCH 17/55] Introduce c_value_print_inner Tom Tromey
2019-12-08 18:52 ` [PATCH 37/55] Simplify generic_val_print_float Tom Tromey
2019-12-08 18:52 ` [PATCH 45/55] Introduce cp_print_value Tom Tromey
2019-12-08 18:54 ` [PATCH 49/55] Introduce ada_value_print_num Tom Tromey
2019-12-08 18:54 ` [PATCH 47/55] Introduce ada_value_print_ptr Tom Tromey
2019-12-08 18:54 ` [PATCH 36/55] Introduce generic_value_print_char Tom Tromey
2019-12-08 18:54 ` [PATCH 31/55] Fix generic_val_print_enum for value-based printing Tom Tromey
2020-01-15  0:37 ` [PATCH 00/55] Remove val_print Tom Tromey
2020-01-15 11:52   ` Simon Marchi
2020-03-14  0:02     ` 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).