@var{bitsize}. The default is @code{int}.
@item group
-The register group to which this register belongs. It must
-be either @code{general}, @code{float}, or @code{vector}. If no
-@var{group} is specified, @value{GDBN} will not display the register
-in @code{info registers}.
+The register group to which this register belongs. It can be one of the
+standard register groups @code{general}, @code{float}, @code{vector} or an
+arbitrary string. Group names should be limited to alphanumeric characters.
+If a group name is made up of multiple words the words may be separated by
+hyphens; e.g.@: @code{special-group} or @code{ultra-special-group}. If no
+@var{group} is specified, @value{GDBN} will not display the register in
+@code{info registers}.
@end table
int save_restore;
/* The name of the register group containing this register, or empty
- if the group should be automatically determined from the
- register's type. If this is "general", "float", or "vector", the
- corresponding "info" command should display this register's
- value. It can be an arbitrary string, but should be limited to
- alphanumeric characters and internal hyphens. Currently other
- strings are ignored (treated as empty). */
+ if the group should be automatically determined from the register's
+ type. This is traditionally "general", "float", "vector" but can
+ also be an arbitrary string. If defined the corresponding "info"
+ command should display this register's value. The string should be
+ limited to alphanumeric characters and internal hyphens. */
std::string group;
/* The size of the register, in bits. */
}
/* Check whether REGNUM is a member of REGGROUP. Registers from the
- target description may be classified as general, float, or vector.
- Unlike a gdbarch register_reggroup_p method, this function will
- return -1 if it does not know; the caller should handle registers
- with no specified group.
-
- Arbitrary strings (other than "general", "float", and "vector")
- from the description are not used; they cause the register to be
- displayed in "info all-registers" but excluded from "info
- registers" et al. The names of containing features are also not
- used. This might be extended to display registers in some more
- useful groupings.
+ target description may be classified as general, float, vector or other
+ register groups registered with reggroup_add(). Unlike a gdbarch
+ register_reggroup_p method, this function will return -1 if it does not
+ know; the caller should handle registers with no specified group.
+
+ The names of containing features are not used. This might be extended
+ to display registers in some more useful groupings.
The save-restore flag is also implemented here. */
{
struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno);
- if (reg != NULL && !reg->group.empty ())
- {
- int general_p = 0, float_p = 0, vector_p = 0;
-
- if (reg->group == "general")
- general_p = 1;
- else if (reg->group == "float")
- float_p = 1;
- else if (reg->group == "vector")
- vector_p = 1;
-
- if (reggroup == float_reggroup)
- return float_p;
-
- if (reggroup == vector_reggroup)
- return vector_p;
-
- if (reggroup == general_reggroup)
- return general_p;
- }
+ if (reg != NULL && !reg->group.empty ()
+ && (reg->group == reggroup_name (reggroup)))
+ return 1;
if (reg != NULL
&& (reggroup == save_reggroup || reggroup == restore_reggroup))
void **slot = htab_find_slot (reg_hash, reg.get (), INSERT);
*slot = reg.get ();
+ /* Add reggroup if its new. */
+ if (!reg->group.empty ())
+ if (reggroup_find (gdbarch, reg->group.c_str ()) == NULL)
+ reggroup_add (gdbarch, reggroup_gdbarch_new (gdbarch,
+ reg->group.c_str (),
+ USER_REGGROUP));
}
/* Remove any registers which were assigned numbers by the