From: Luis Machado <luis.machado@arm.com>
To: Ciaran Woodward <ciaranwoodward@xmos.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/tdesc: Don't assign custom-group tdesc registers to 'general'
Date: Thu, 7 Sep 2023 18:47:09 +0100 [thread overview]
Message-ID: <e6ff321b-07c9-f16c-09a8-5b16bb4daa3f@arm.com> (raw)
In-Reply-To: <20230907170752.28639-1-ciaranwoodward@xmos.com>
Hi,
On 9/7/23 18:07, Ciaran Woodward wrote:
> The 'Target Description' mechanism in GDB enables the target to
> supply the full set of registers available on the system to gdb
> in an XML format.
>
> This format enables setting the 'group' of each register, such
> that they can be queried using the 'info registers <group>'
> mechanism.
>
> However prior to this change, even if a register was explicitly
> assigned to a group, it would still show up in the
> 'info registers general' report. This is unexpected, and also
> disagrees with the comment above the tdesc_register_in_reggroup_p
> function, which says that '-1' should be returned if the register
> group is not-known, not the register group is known, but differs.
>
> There was a previous change that did address this issue in
> aa66aac47b4dd38f9524ddb5546c08cc09930d37
> but it also caused registers with *no* group in the target
> description to be removed from 'general', so it was reverted in
> 440cf44eb0f70830b8d8ac35289f84129c7a35c1
> as that behaviour was used by some targets.
>
> The change in this commit enhances the usefulness of the tdesc
> 'group' attribute for adding system configuration registers,
> of which there may be hundreds - very inconvenient to request
> and print on every 'info registers' call.
> ---
>
> Email archive link to discussion of previously referenced patch:
> https://inbox.sourceware.org/gdb-patches/20200120155315.30333-1-shahab.vahedi@gmail.com/T/#m0ce2983153b2f482b66461ed6b97c4b287b09a89
>
> gdb/target-descriptions.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
> index cdedf88c793..c1bb03c3adf 100644
> --- a/gdb/target-descriptions.c
> +++ b/gdb/target-descriptions.c
> @@ -954,14 +954,13 @@ tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno,
> {
> struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno);
>
> - if (reg != NULL && !reg->group.empty ()
> - && (reg->group == reggroup->name ()))
> - return 1;
> -
> if (reg != NULL
> && (reggroup == save_reggroup || reggroup == restore_reggroup))
> return reg->save_restore;
>
> + if (reg != NULL && !reg->group.empty ())
> + return (reg->group == reggroup->name ());
> +
> return -1;
> }
>
Yeah, this is a hard one. Unfortunately the outcome then was that we have a number of debugging stubs out in the open that advertise xml's with less-than-correct group information.
I think even gdb, to this day, is guilty of that.
Though the patch doesn't regress things as much as before, it still makes the 32-bit Arm gdb drop the fpscr register from the general display (info registers).
Depending on what others think, and the benefit of not having a bunch of system registers show up every time, we could cope with this particular regression.
next prev parent reply other threads:[~2023-09-07 17:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 17:07 Ciaran Woodward
2023-09-07 17:47 ` Luis Machado [this message]
2023-09-11 10:31 ` Andrew Burgess
2023-09-11 18:41 ` Ciaran Woodward
2023-09-12 13:48 ` Andrew Burgess
2023-09-12 15:10 ` Luis Machado
2023-09-11 10:52 ` Andrew Burgess
2023-09-11 18:33 ` Ciaran Woodward
2023-09-12 13:33 ` Andrew Burgess
2023-09-13 11:41 ` [PATCH v2] " Ciaran Woodward
2023-11-20 13:25 ` [PING][PATCH " Ciaran Woodward
2023-11-21 13:57 ` Luis Machado
2023-11-21 18:17 ` Ciaran Woodward
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=e6ff321b-07c9-f16c-09a8-5b16bb4daa3f@arm.com \
--to=luis.machado@arm.com \
--cc=ciaranwoodward@xmos.com \
--cc=gdb-patches@sourceware.org \
/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).