aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-03-31 18:10:34 +0100
committerAndrew Burgess <aburgess@redhat.com>2022-04-07 16:01:18 +0100
commitaf7ce09b7685050d2ca1a8a746bb8a8c080fff69 (patch)
tree7f98b85a0c9b02742561f15e09fb66063b0a439f /gdb
parentc30c0f062e52b7a827d8571cdafcd04c9e71ab6b (diff)
downloadgdb-af7ce09b7685050d2ca1a8a746bb8a8c080fff69.zip
gdb-af7ce09b7685050d2ca1a8a746bb8a8c080fff69.tar.gz
gdb-af7ce09b7685050d2ca1a8a746bb8a8c080fff69.tar.bz2
gdb: move struct reggroup into reggroups.h header
Move 'struct reggroup' into the reggroups.h header. Remove the reggroup_name and reggroup_type accessor functions, and just use the name/type member functions within 'struct reggroup', update all uses of these removed functions. There should be no user visible changes after this commit.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/completer.c2
-rw-r--r--gdb/infcmd.c2
-rw-r--r--gdb/nds32-tdep.c2
-rw-r--r--gdb/python/py-registers.c3
-rw-r--r--gdb/regcache-dump.c3
-rw-r--r--gdb/reggroups.c41
-rw-r--r--gdb/reggroups.h32
-rw-r--r--gdb/target-descriptions.c2
-rw-r--r--gdb/tui/tui-regs.c6
9 files changed, 36 insertions, 57 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index f4b5917..fea3eb9 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1821,7 +1821,7 @@ reg_or_group_completer_1 (completion_tracker &tracker,
{
for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
{
- name = reggroup_name (group);
+ name = group->name ();
if (strncmp (word, name, len) == 0)
tracker.add_completion (make_unique_xstrdup (name));
}
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9abb91f..719bd68 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2301,7 +2301,7 @@ registers_info (const char *addr_exp, int fpregs)
/* Don't bother with a length check. Should the user
enter a short register group name, go with the first
group that matches. */
- if (strncmp (start, reggroup_name (g), end - start) == 0)
+ if (strncmp (start, g->name (), end - start) == 0)
{
group = g;
break;
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 06b129b..e95ad7c 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -390,7 +390,7 @@ nds32_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
/* The NDS32 reggroup contains registers whose name is prefixed
by reggroup name. */
reg_name = gdbarch_register_name (gdbarch, regnum);
- group_name = reggroup_name (reggroup);
+ group_name = reggroup->name ();
return !strncmp (reg_name, group_name, strlen (group_name));
}
diff --git a/gdb/python/py-registers.c b/gdb/python/py-registers.c
index 6255dda..bbb322f 100644
--- a/gdb/python/py-registers.c
+++ b/gdb/python/py-registers.c
@@ -136,8 +136,7 @@ gdbpy_reggroup_to_string (PyObject *self)
reggroup_object *group = (reggroup_object *) self;
const reggroup *reggroup = group->reggroup;
- const char *name = reggroup_name (reggroup);
- return PyUnicode_FromString (name);
+ return PyUnicode_FromString (reggroup->name ());
}
/* Implement gdb.RegisterGroup.name (self) -> String.
diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c
index 409a868..0c5da0e 100644
--- a/gdb/regcache-dump.c
+++ b/gdb/regcache-dump.c
@@ -196,8 +196,7 @@ protected:
{
if (gdbarch_register_reggroup_p (m_gdbarch, regnum, group))
{
- gdb_printf (file,
- "%s%s", sep, reggroup_name (group));
+ gdb_printf (file, "%s%s", sep, group->name ());
sep = ",";
}
}
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index 643337e..4223281 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -28,33 +28,6 @@
#include "gdbcmd.h" /* For maintenanceprintlist. */
#include "gdbsupport/gdb_obstack.h"
-/* Individual register groups. */
-
-struct reggroup
-{
- /* Create a new register group object. The NAME is not owned by the new
- reggroup object, so must outlive the object. */
- reggroup (const char *name, enum reggroup_type type)
- : m_name (name),
- m_type (type)
- { /* Nothing. */ }
-
- /* Return the name for this register group. */
- const char *name () const
- { return m_name; }
-
- /* Return the type of this register group. */
- enum reggroup_type type () const
- { return m_type; }
-
-private:
- /* The name of this register group. */
- const char *m_name;
-
- /* The type of this register group. */
- enum reggroup_type m_type;
-};
-
const reggroup *
reggroup_new (const char *name, enum reggroup_type type)
{
@@ -72,20 +45,6 @@ reggroup_gdbarch_new (struct gdbarch *gdbarch, const char *name,
name, type);
}
-/* Register group attributes. */
-
-const char *
-reggroup_name (const struct reggroup *group)
-{
- return group->name ();
-}
-
-enum reggroup_type
-reggroup_type (const struct reggroup *group)
-{
- return group->type ();
-}
-
/* A container holding all the register groups for a particular
architecture. */
diff --git a/gdb/reggroups.h b/gdb/reggroups.h
index 2f38b67..5f8a8a3 100644
--- a/gdb/reggroups.h
+++ b/gdb/reggroups.h
@@ -23,10 +23,36 @@
#define REGGROUPS_H
struct gdbarch;
-struct reggroup;
enum reggroup_type { USER_REGGROUP, INTERNAL_REGGROUP };
+/* Individual register group. */
+
+struct reggroup
+{
+ /* Create a new register group object. The NAME is not owned by the new
+ reggroup object, so must outlive the object. */
+ reggroup (const char *name, enum reggroup_type type)
+ : m_name (name),
+ m_type (type)
+ { /* Nothing. */ }
+
+ /* Return the name for this register group. */
+ const char *name () const
+ { return m_name; }
+
+ /* Return the type of this register group. */
+ enum reggroup_type type () const
+ { return m_type; }
+
+private:
+ /* The name of this register group. */
+ const char *m_name;
+
+ /* The type of this register group. */
+ enum reggroup_type m_type;
+};
+
/* Pre-defined, user visible, register groups. */
extern const reggroup *const general_reggroup;
extern const reggroup *const float_reggroup;
@@ -50,10 +76,6 @@ extern const reggroup *reggroup_gdbarch_new (struct gdbarch *gdbarch,
/* Add a register group (with attribute values) to the pre-defined list. */
extern void reggroup_add (struct gdbarch *gdbarch, const reggroup *group);
-/* Register group attributes. */
-extern const char *reggroup_name (const struct reggroup *reggroup);
-extern enum reggroup_type reggroup_type (const struct reggroup *reggroup);
-
/* Return the list of all register groups for GDBARCH. */
extern const std::vector<const reggroup *> &
gdbarch_reggroups (struct gdbarch *gdbarch);
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 33277c3..85954ac 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1012,7 +1012,7 @@ 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 (reggroup)))
+ && (reg->group == reggroup->name ()))
return 1;
if (reg != NULL
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 2e597d0..5106a3b 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -216,7 +216,7 @@ tui_data_window::show_register_group (const reggroup *group,
int regnum, pos;
/* Make a new title showing which group we display. */
- title = string_printf ("Register group: %s", reggroup_name (group));
+ title = string_printf ("Register group: %s", group->name ());
/* See how many registers must be displayed. */
nr_regs = 0;
@@ -595,7 +595,7 @@ tui_reg_command (const char *args, int from_tty)
group then the switch is made. */
for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
{
- if (strncmp (reggroup_name (group), args, len) == 0)
+ if (strncmp (group->name (), args, len) == 0)
{
if (match != NULL)
error (_("ambiguous register group name '%s'"), args);
@@ -621,7 +621,7 @@ tui_reg_command (const char *args, int from_tty)
if (!first)
gdb_printf (", ");
first = false;
- gdb_printf ("%s", reggroup_name (group));
+ gdb_printf ("%s", group->name ());
}
gdb_printf ("\n");