xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/reggroups.h (revision c9055873d0546e63388f027d3d7f85381cde0545)
1 /* Register groupings for GDB, the GNU debugger.
2 
3    Copyright (C) 2002-2023 Free Software Foundation, Inc.
4 
5    Contributed by Red Hat.
6 
7    This file is part of GDB.
8 
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21 
22 #ifndef REGGROUPS_H
23 #define REGGROUPS_H
24 
25 struct gdbarch;
26 
27 /* The different register group types.  */
28 enum reggroup_type {
29   /* Used for any register group that should be visible to the user.
30      Architecture specific register groups, as well as most of the default
31      groups will have this type.  */
32   USER_REGGROUP,
33 
34   /* Used for a few groups that GDB uses while managing machine state.
35      These groups are mostly hidden from the user.  */
36   INTERNAL_REGGROUP
37 };
38 
39 /* Individual register group.  */
40 
41 struct reggroup
42 {
43   /* Create a new register group object.  The NAME is not owned by the new
44      reggroup object, so must outlive the object.  */
45   reggroup (const char *name, enum reggroup_type type)
46     : m_name (name),
47       m_type (type)
48   { /* Nothing.  */ }
49 
50   /* Return the name for this register group.  */
51   const char *name () const
52   { return m_name; }
53 
54   /* Return the type of this register group.  */
55   enum reggroup_type type () const
56   { return m_type; }
57 
58 private:
59   /* The name of this register group.  */
60   const char *m_name;
61 
62   /* The type of this register group.  */
63   enum reggroup_type m_type;
64 };
65 
66 /* Pre-defined, user visible, register groups.  */
67 extern const reggroup *const general_reggroup;
68 extern const reggroup *const float_reggroup;
69 extern const reggroup *const system_reggroup;
70 extern const reggroup *const vector_reggroup;
71 extern const reggroup *const all_reggroup;
72 
73 /* Pre-defined, internal, register groups.  */
74 extern const reggroup *const save_reggroup;
75 extern const reggroup *const restore_reggroup;
76 
77 /* Create a new local register group.  */
78 extern const reggroup *reggroup_new (const char *name,
79 				     enum reggroup_type type);
80 
81 /* Create a new register group allocated onto the gdbarch obstack.  */
82 extern const reggroup *reggroup_gdbarch_new (struct gdbarch *gdbarch,
83 					     const char *name,
84 					     enum reggroup_type type);
85 
86 /* Add register group GROUP to the list of register groups for GDBARCH.  */
87 extern void reggroup_add (struct gdbarch *gdbarch, const reggroup *group);
88 
89 /* Return the list of all register groups for GDBARCH.  */
90 extern const std::vector<const reggroup *> &
91 	gdbarch_reggroups (struct gdbarch *gdbarch);
92 
93 /* Find a reggroup by name.  */
94 extern const reggroup *reggroup_find (struct gdbarch *gdbarch,
95 				      const char *name);
96 
97 /* Is REGNUM a member of REGGROUP?  */
98 extern int default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
99 					const struct reggroup *reggroup);
100 
101 #endif
102