regdef.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Register protocol definition structures for the GNU Debugger
  2. Copyright (C) 2001-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef REGFORMATS_REGDEF_H
  15. #define REGFORMATS_REGDEF_H
  16. namespace gdb {
  17. struct reg
  18. {
  19. reg (int _offset)
  20. : name (""),
  21. offset (_offset),
  22. size (0)
  23. {}
  24. reg (const char *_name, int _offset, int _size)
  25. : name (_name),
  26. offset (_offset),
  27. size (_size)
  28. {}
  29. /* The name of this register - NULL for pad entries. */
  30. const char *name;
  31. /* At the moment, both of the following bit counts must be divisible
  32. by eight (to match the representation as two hex digits) and divisible
  33. by the size of a byte (to match the layout of each register in
  34. memory). */
  35. /* The offset (in bits) of the value of this register in the buffer. */
  36. int offset;
  37. /* The size (in bits) of the value of this register, as transmitted. */
  38. int size;
  39. bool operator== (const reg &other) const
  40. {
  41. return (strcmp (name, other.name) == 0
  42. && offset == other.offset
  43. && size == other.size);
  44. }
  45. bool operator!= (const reg &other) const
  46. {
  47. return !(*this == other);
  48. }
  49. };
  50. } /* namespace gdb */
  51. #endif /* REGFORMATS_REGDEF_H */