From: Simon Marchi <simon.marchi@polymtl.ca>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCHv2 09/16] gdb: always add the default register groups
Date: Wed, 6 Apr 2022 09:22:50 -0400 [thread overview]
Message-ID: <b72475d6-4381-90a7-1c64-c756aa0b0b70@polymtl.ca> (raw)
In-Reply-To: <5163f39f318a89b14ca41ecb4121f60ede41351b.1649246539.git.aburgess@redhat.com>
On 2022-04-06 08:04, Andrew Burgess via Gdb-patches wrote:
> There's a set of 7 default register groups. If we don't add any
> gdbarch specific register groups during gdbarch initialisation, then
> when we iterate over the register groups using reggroup_next and
> reggroup_prev we will make use of these 7 default groups. See the use
> of default_groups in gdb/reggroups.c for details on this.
>
> However, if the gdbarch adds its own groups during gdbarch
> initialisation, then these groups will be used in preference to the
> default groups.
>
> A problem arises though if the particular architecture makes use of
> the target description mechanism. If the default target
> description(s) (i.e. those internal to GDB that are used when the user
> doesn't provide their own) don't mention any additional register
> groups then the default register groups will be used.
>
> But if the target description does mention additional groups then the
> default groups are not used, and instead, the groups from the target
> description are used.
>
> The problem with this is that what usually happens is that the target
> description will mention additional groups, e.g. groups for special
> registers. Most architectures that use target descriptions work
> around this by adding all (or most) of the default register groups in
> all cases. See i386_add_reggroups, aarch64_add_reggroups,
> riscv_add_reggroups, xtensa_add_reggroups, and others.
>
> In this patch, my suggestion is that we should just add the default
> register groups for every architecture, always. This change is in
> gdb/reggroups.c.
>
> All the remaining changes are me updating the various architectures to
> not add the default groups themselves.
>
> So, where will this change be visible to the user? I think the
> following commands will possibly change:
>
> * info registers / info all-registers:
>
> The user can provide a register group to these commands. For example,
> on csky, we previously never added the 'vector' group. Now, as a
> default group, this will be available, but (presumably) will not
> contain any registers. I don't think this is necessarily a bad
> thing, there's something to be said for having some consistent
> defaults available. There are other architectures that didn't add
> all 7 of the defaults, which will now have gained additional groups.
>
> * maint print reggroups
>
> This prints the set of all available groups. As a maintenance
> command I'm less concerned with the output changing here.
> Obviously, for the architectures that didn't previously add all the
> defaults, this list just got bigger.
>
> * maint print register-groups
>
> This prints all the registers, and the groups they are in. If the
> defaults were not previously being added then a register (obviously)
> can't appear in one of the default groups. Now the groups are
> available then registers might be in more groups than previously.
> However, this is again a maintenance command, so I'm less concerned
> about this changing.
That sounds reasonable to me.
> @@ -119,13 +110,44 @@ reggroup_add (struct gdbarch *gdbarch, struct reggroup *group)
> struct reggroups *groups
> = (struct reggroups *) gdbarch_data (gdbarch, reggroups_data);
>
> + /* The same reggroup should not be added multiple times. */
> + gdb_assert (groups != nullptr);
> + for (struct reggroup_el *el = groups->first;
> + el != nullptr;
> + el = el->next)
> + gdb_assert (group != el->group);
The "for" can be on a single line.
Simon
next prev parent reply other threads:[~2022-04-06 13:22 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 21:04 [PATCH 00/16] Default register groups, and general related cleanup Andrew Burgess
2022-03-31 21:04 ` [PATCH 01/16] gdb: don't try to use readline before it's initialized Andrew Burgess
2022-03-31 21:04 ` [PATCH 02/16] gdb: add some const in gdb/reggroups.c Andrew Burgess
2022-03-31 21:04 ` [PATCH 03/16] gdb: make gdbarch_register_reggroup_p take a const reggroup * Andrew Burgess
2022-04-04 22:35 ` Lancelot SIX
2022-04-05 8:24 ` Andrew Burgess
2022-03-31 21:04 ` [PATCH 04/16] gdb: switch to using 'const reggroup *' in tui-regs.{c, h} Andrew Burgess
2022-03-31 21:04 ` [PATCH 05/16] gdb: use 'const reggroup *' in python/py-registers.c file Andrew Burgess
2022-03-31 21:04 ` [PATCH 06/16] gdb: have reggroup_find return a const Andrew Burgess
2022-03-31 21:04 ` [PATCH 07/16] gdb/tui: avoid theoretical bug with 'tui reg' command Andrew Burgess
2022-03-31 21:04 ` [PATCH 08/16] gdb/tui: fix 'tui reg next/prev' command when data window is hidden Andrew Burgess
2022-03-31 21:04 ` [PATCH 09/16] gdb: always add the default register groups Andrew Burgess
2022-03-31 21:04 ` [PATCH 10/16] gdb: convert reggroups to use a std::vector Andrew Burgess
2022-03-31 21:04 ` [PATCH 11/16] gdb: remove reggroup_next and reggroup_prev Andrew Burgess
2022-04-05 23:11 ` Lancelot SIX
2022-04-06 12:06 ` Andrew Burgess
2022-03-31 21:04 ` [PATCH 12/16] gdb: more 'const' in gdb/reggroups.{c,h} Andrew Burgess
2022-03-31 21:04 ` [PATCH 13/16] gdb: make the pre-defined register groups const Andrew Burgess
2022-03-31 21:04 ` [PATCH 14/16] gdb: convert reggroup to a C++ class with constructor, etc Andrew Burgess
2022-03-31 21:04 ` [PATCH 15/16] gdb: move struct reggroup into reggroups.h header Andrew Burgess
2022-03-31 21:04 ` [PATCH 16/16] gdb: update comments throughout reggroups.{c,h} files Andrew Burgess
2022-04-06 14:28 ` Simon Marchi
2022-04-06 12:04 ` [PATCHv2 00/16] Default register groups, and general related cleanup Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 01/16] gdb: don't try to use readline before it's initialized Andrew Burgess
2022-04-06 12:57 ` Simon Marchi
2022-04-06 12:04 ` [PATCHv2 02/16] gdb: add some const in gdb/reggroups.c Andrew Burgess
2022-04-06 12:58 ` Simon Marchi
2022-04-06 12:04 ` [PATCHv2 03/16] gdb: make gdbarch_register_reggroup_p take a const reggroup * Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 04/16] gdb: switch to using 'const reggroup *' in tui-regs.{c, h} Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 05/16] gdb: use 'const reggroup *' in python/py-registers.c file Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 06/16] gdb: have reggroup_find return a const Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 07/16] gdb/tui: avoid theoretical bug with 'tui reg' command Andrew Burgess
2022-04-06 13:02 ` Simon Marchi
2022-04-06 12:04 ` [PATCHv2 08/16] gdb/tui: fix 'tui reg next/prev' command when data window is hidden Andrew Burgess
2022-04-06 13:13 ` Simon Marchi
2022-04-06 12:04 ` [PATCHv2 09/16] gdb: always add the default register groups Andrew Burgess
2022-04-06 13:22 ` Simon Marchi [this message]
2022-04-06 12:04 ` [PATCHv2 10/16] gdb: convert reggroups to use a std::vector Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 11/16] gdb: remove reggroup_next and reggroup_prev Andrew Burgess
2022-04-06 14:22 ` Simon Marchi
2022-04-06 14:23 ` Simon Marchi
2022-04-06 12:04 ` [PATCHv2 12/16] gdb: more 'const' in gdb/reggroups.{c,h} Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 13/16] gdb: make the pre-defined register groups const Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 14/16] gdb: convert reggroup to a C++ class with constructor, etc Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 15/16] gdb: move struct reggroup into reggroups.h header Andrew Burgess
2022-04-06 12:04 ` [PATCHv2 16/16] gdb: update comments throughout reggroups.{c, h} files Andrew Burgess
2022-04-06 14:34 ` [PATCHv2 00/16] Default register groups, and general related cleanup Simon Marchi
2022-04-07 15:16 ` Andrew Burgess
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=b72475d6-4381-90a7-1c64-c756aa0b0b70@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=aburgess@redhat.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).