{
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));
}
/* 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;
/* 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));
}
\f
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.
{
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 = ",";
}
}
#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)
{
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. */
#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;
/* 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);
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
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;
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);
if (!first)
gdb_printf (", ");
first = false;
- gdb_printf ("%s", reggroup_name (group));
+ gdb_printf ("%s", group->name ());
}
gdb_printf ("\n");