reggroups.h 3.2 KB

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