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.
This commit is contained in:
parent
c30c0f062e
commit
af7ce09b76
9 changed files with 36 additions and 57 deletions
|
@ -1821,7 +1821,7 @@ reg_or_group_completer_1 (completion_tracker &tracker,
|
||||||
{
|
{
|
||||||
for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
|
for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
|
||||||
{
|
{
|
||||||
name = reggroup_name (group);
|
name = group->name ();
|
||||||
if (strncmp (word, name, len) == 0)
|
if (strncmp (word, name, len) == 0)
|
||||||
tracker.add_completion (make_unique_xstrdup (name));
|
tracker.add_completion (make_unique_xstrdup (name));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2301,7 +2301,7 @@ registers_info (const char *addr_exp, int fpregs)
|
||||||
/* Don't bother with a length check. Should the user
|
/* Don't bother with a length check. Should the user
|
||||||
enter a short register group name, go with the first
|
enter a short register group name, go with the first
|
||||||
group that matches. */
|
group that matches. */
|
||||||
if (strncmp (start, reggroup_name (g), end - start) == 0)
|
if (strncmp (start, g->name (), end - start) == 0)
|
||||||
{
|
{
|
||||||
group = g;
|
group = g;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -390,7 +390,7 @@ nds32_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||||
/* The NDS32 reggroup contains registers whose name is prefixed
|
/* The NDS32 reggroup contains registers whose name is prefixed
|
||||||
by reggroup name. */
|
by reggroup name. */
|
||||||
reg_name = gdbarch_register_name (gdbarch, regnum);
|
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));
|
return !strncmp (reg_name, group_name, strlen (group_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,8 +136,7 @@ gdbpy_reggroup_to_string (PyObject *self)
|
||||||
reggroup_object *group = (reggroup_object *) self;
|
reggroup_object *group = (reggroup_object *) self;
|
||||||
const reggroup *reggroup = group->reggroup;
|
const reggroup *reggroup = group->reggroup;
|
||||||
|
|
||||||
const char *name = reggroup_name (reggroup);
|
return PyUnicode_FromString (reggroup->name ());
|
||||||
return PyUnicode_FromString (name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement gdb.RegisterGroup.name (self) -> String.
|
/* Implement gdb.RegisterGroup.name (self) -> String.
|
||||||
|
|
|
@ -196,8 +196,7 @@ protected:
|
||||||
{
|
{
|
||||||
if (gdbarch_register_reggroup_p (m_gdbarch, regnum, group))
|
if (gdbarch_register_reggroup_p (m_gdbarch, regnum, group))
|
||||||
{
|
{
|
||||||
gdb_printf (file,
|
gdb_printf (file, "%s%s", sep, group->name ());
|
||||||
"%s%s", sep, reggroup_name (group));
|
|
||||||
sep = ",";
|
sep = ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,33 +28,6 @@
|
||||||
#include "gdbcmd.h" /* For maintenanceprintlist. */
|
#include "gdbcmd.h" /* For maintenanceprintlist. */
|
||||||
#include "gdbsupport/gdb_obstack.h"
|
#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 *
|
const reggroup *
|
||||||
reggroup_new (const char *name, enum reggroup_type type)
|
reggroup_new (const char *name, enum reggroup_type type)
|
||||||
{
|
{
|
||||||
|
@ -72,20 +45,6 @@ reggroup_gdbarch_new (struct gdbarch *gdbarch, const char *name,
|
||||||
name, 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
|
/* A container holding all the register groups for a particular
|
||||||
architecture. */
|
architecture. */
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,36 @@
|
||||||
#define REGGROUPS_H
|
#define REGGROUPS_H
|
||||||
|
|
||||||
struct gdbarch;
|
struct gdbarch;
|
||||||
struct reggroup;
|
|
||||||
|
|
||||||
enum reggroup_type { USER_REGGROUP, INTERNAL_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. */
|
/* Pre-defined, user visible, register groups. */
|
||||||
extern const reggroup *const general_reggroup;
|
extern const reggroup *const general_reggroup;
|
||||||
extern const reggroup *const float_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. */
|
/* Add a register group (with attribute values) to the pre-defined list. */
|
||||||
extern void reggroup_add (struct gdbarch *gdbarch, const reggroup *group);
|
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. */
|
/* Return the list of all register groups for GDBARCH. */
|
||||||
extern const std::vector<const reggroup *> &
|
extern const std::vector<const reggroup *> &
|
||||||
gdbarch_reggroups (struct gdbarch *gdbarch);
|
gdbarch_reggroups (struct gdbarch *gdbarch);
|
||||||
|
|
|
@ -1012,7 +1012,7 @@ tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno,
|
||||||
struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno);
|
struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno);
|
||||||
|
|
||||||
if (reg != NULL && !reg->group.empty ()
|
if (reg != NULL && !reg->group.empty ()
|
||||||
&& (reg->group == reggroup_name (reggroup)))
|
&& (reg->group == reggroup->name ()))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (reg != NULL
|
if (reg != NULL
|
||||||
|
|
|
@ -216,7 +216,7 @@ tui_data_window::show_register_group (const reggroup *group,
|
||||||
int regnum, pos;
|
int regnum, pos;
|
||||||
|
|
||||||
/* Make a new title showing which group we display. */
|
/* 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. */
|
/* See how many registers must be displayed. */
|
||||||
nr_regs = 0;
|
nr_regs = 0;
|
||||||
|
@ -595,7 +595,7 @@ tui_reg_command (const char *args, int from_tty)
|
||||||
group then the switch is made. */
|
group then the switch is made. */
|
||||||
for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
|
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)
|
if (match != NULL)
|
||||||
error (_("ambiguous register group name '%s'"), args);
|
error (_("ambiguous register group name '%s'"), args);
|
||||||
|
@ -621,7 +621,7 @@ tui_reg_command (const char *args, int from_tty)
|
||||||
if (!first)
|
if (!first)
|
||||||
gdb_printf (", ");
|
gdb_printf (", ");
|
||||||
first = false;
|
first = false;
|
||||||
gdb_printf ("%s", reggroup_name (group));
|
gdb_printf ("%s", group->name ());
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_printf ("\n");
|
gdb_printf ("\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue