public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>, Gareth Rees <grees@undo.io>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v5] [PR mi/29554] New PRINT-VALUES option '--scalar-values'.
Date: Mon, 13 Mar 2023 17:17:59 +0000	[thread overview]
Message-ID: <87v8j4fu48.fsf@redhat.com> (raw)
In-Reply-To: <83r0twzu8r.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gareth Rees <grees@undo.io>
>> Date: Fri, 10 Mar 2023 11:04:42 +0000
>> Cc: gdb-patches@sourceware.org
>> 
>> This also makes sense to me, but this is not a decision that I am in a
>> position to make! The experienced GDB developers -- in particular, you
>> and Eli -- need to come to an agreement about which approach is best
>> in this case: do you prefer to take the risk of a backward-
>> incompatible change (GDB/MI clients can no longer get the values for
>> references to compound types in C++ programs using --simple-values) or
>> do you prefer to accept the cost of leaving (what looks like) a
>> mistake to stand forever? I can implement whichever you think is best.
>> 
>> For the moment I will prepare a revised patch implementing solution #1
>> and addressing your other review comments. If Eli can also follow up
>> and help us reach a conclusion on the best design, that would be
>> great.
>
> The reason why I preferred #2 is simple: it avoids incompatible
> changes in the behavior of existing options.

I think we need to be careful not to paint this change as worse than it
really is.

If we picked option #1 then this would change the output in some cases,
so obviously, there could be a user out there that depends on a
particular output in a given situation, and any changes will break their
use case.  But....

... for a well written front-end, picking option #1 should be a
transparent change.  They already have to handle passing non-references
to non-scalar types.  Option #1 simply redistributes which value types
fall into which category, it doesn't do anything that we didn't do
before.


>                                               Since it was not really
> clear-cut that the previous behavior was a bug, the backward
> incompatibility could cause trouble to some application or use case
> which didn't consider it was a bug and relied on that behavior.

I agree, we will likely never know with certainty if the existing GDB
behaviour was by design, or by accident.

That said, my guess would be accident, but I also think that's likely
irrelevant here.

GDB isn't printing something that's incorrect -- that would clearly be a
bug.  And GDB isn't crashing -- that too would clearly be a bug.

So I think this becomes more a GDB development question: if we release a
miss-feature does that mean we have to guarantee to support that
miss-feature forever?  Or are we allowed to go in an make adjustments?

On one extreme we can take the position that once somethings out the
door we must NEVER break compatibility.  EVER.

On the other extreme everything could change with every release.

I think the both of these positions would not be good for GDB.
Personally, I'm more toward the conservative end.  I think stability is
good.

But I also think we do need to be open to making considered changes,
otherwise, we end up carrying around an increasing volume of technical
debt that makes future work progressively harder.

In this case my think was:

  1. The option #1 behaviour is now inline with GDB's CLI behaviour,
     i.e. hiding the values of non-scalar reference variables by default,

  2. A well written application should transparently handle this case
     anyway as we're not adding a new output format, and

  3. The current behaviour (I would say) is clearly unexpected, you ask
     GDB for simple values only, and you could get back a value of
     (almost) unlimited size.

  4. The option #1 patch already included an MI feature flag.  This
     doesn't stop a badly written MI front-end from breaking, but it
     does mean the maintainer can query the flag to figure out when to
     apply the fix-up behaviour.

> Introducing a new option is free from this problem.

But not free in maintenance cost.

If we really feel that the old behaviour is worth saving then adding a
new flag isn't the end of the world.  I'd just want to make sure we
really have considered the alternatives first.

Thanks,

Andrew


  parent reply	other threads:[~2023-03-13 17:18 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  7:18 [PATCH] [gdb/mi] Don't treat references to compound values as "simple" Gareth Rees
2022-09-08 10:27 ` Andrew Burgess
2022-09-08 11:02   ` [PATCH v2] " Gareth Rees
2022-09-08 13:30     ` Eli Zaretskii
2022-09-08 13:58       ` Gareth Rees
2022-09-08 14:07         ` Eli Zaretskii
2022-09-09  8:01       ` [PATCH v3] [PR mi/29554] New PRINT-VALUES option '--scalar-values' Gareth Rees
2022-09-15  9:06         ` [PING] " Gareth Rees
2022-09-25  8:15         ` Gareth Rees
2022-09-25  8:25           ` Eli Zaretskii
2022-09-25  9:00             ` Gareth Rees
2022-09-25 10:16               ` Eli Zaretskii
2022-09-26 12:48                 ` Gareth Rees
2022-09-25 10:16           ` Eli Zaretskii
2022-09-26 12:46         ` [PATCH v4] " Gareth Rees
2022-10-04  9:08           ` [PING] " Gareth Rees
2022-10-18 11:59             ` Gareth Rees
2022-10-12 16:38           ` Andrew Burgess
2022-10-20 17:47             ` [PATCH v5] " Gareth Rees
2022-10-20 18:00               ` Eli Zaretskii
2022-11-03 16:20               ` [PING] " Gareth Rees
2022-11-14  9:25                 ` Gareth Rees
2022-12-01 13:41                 ` Gareth Rees
2022-12-14  8:50                 ` Gareth Rees
2023-02-01 10:00                 ` Gareth Rees
2023-02-16 10:08                 ` Gareth Rees
2023-03-06  9:52                 ` Gareth Rees
2023-03-08 12:35               ` Andrew Burgess
2023-03-10 11:04                 ` Gareth Rees
2023-03-10 12:05                   ` Eli Zaretskii
2023-03-10 12:58                     ` Gareth Rees
2023-03-13 17:17                     ` Andrew Burgess [this message]
2023-03-16 12:28                       ` Gareth Rees
2023-03-11 11:58                   ` Gareth Rees
2023-04-11 13:15                     ` Pedro Alves
2023-03-11 11:49               ` [PATCH v6] [gdb/mi] Don't treat references to compound values as "simple" Gareth Rees
2023-03-21  9:50                 ` [PING] " Gareth Rees
2023-03-26  9:56                   ` Gareth Rees
2023-04-03  9:22                     ` Gareth Rees
2023-05-04 15:08                       ` Tom Tromey
2023-04-18  9:23                   ` Gareth Rees
2023-04-24  9:53                   ` Gareth Rees
2023-05-02  9:13                   ` Gareth Rees
2023-03-27 14:34                 ` Tom Tromey
2023-03-29  9:14                   ` Gareth Rees
2023-04-06 17:18                   ` Gareth Rees
2022-10-20 17:58             ` [PATCH v4] [PR mi/29554] New PRINT-VALUES option '--scalar-values' Gareth Rees
2022-09-09  8:04       ` [PATCH v2] [gdb/mi] Don't treat references to compound values as "simple" Gareth Rees
2022-09-08 11:09   ` [PATCH] " Gareth Rees

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=87v8j4fu48.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=grees@undo.io \
    /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).