public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/tdesc: Don't assign custom-group tdesc registers to 'general'
@ 2023-09-07 17:07 Ciaran Woodward
  2023-09-07 17:47 ` Luis Machado
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Ciaran Woodward @ 2023-09-07 17:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ciaran Woodward

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;
 }
 
-- 
2.25.1


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

end of thread, other threads:[~2023-11-21 18:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 17:07 [PATCH] gdb/tdesc: Don't assign custom-group tdesc registers to 'general' Ciaran Woodward
2023-09-07 17:47 ` Luis Machado
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

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