tdesc.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* Target description definitions for remote server for GDB.
  2. Copyright (C) 2012-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 GDBSERVER_TDESC_H
  15. #define GDBSERVER_TDESC_H
  16. #include "gdbsupport/tdesc.h"
  17. #include "regdef.h"
  18. #include <vector>
  19. /* A target description. Inherit from tdesc_feature so that target_desc
  20. can be used as tdesc_feature. */
  21. struct target_desc final : tdesc_element
  22. {
  23. /* A vector of elements of register definitions that
  24. describe the inferior's register set. */
  25. std::vector<struct gdb::reg> reg_defs;
  26. /* The register cache size, in bytes. */
  27. int registers_size;
  28. /* XML features in this target description. */
  29. std::vector<tdesc_feature_up> features;
  30. #ifndef IN_PROCESS_AGENT
  31. /* An array of register names. These are the "expedite" registers:
  32. registers whose values are sent along with stop replies. */
  33. const char **expedite_regs = NULL;
  34. /* Defines what to return when looking for the "target.xml" file in
  35. response to qXfer:features:read. Its contents can either be
  36. verbatim XML code (prefixed with a '@') or else the name of the
  37. actual XML file to be used in place of "target.xml".
  38. If NULL then its content will be generated by parsing the target
  39. description into xml. */
  40. mutable const char *xmltarget = NULL;
  41. /* The value of <architecture> element in the XML, replying GDB. */
  42. const char *arch = NULL;
  43. /* The value of <osabi> element in the XML, replying GDB. */
  44. const char *osabi = NULL;
  45. public:
  46. target_desc ()
  47. : registers_size (0)
  48. {}
  49. ~target_desc ();
  50. bool operator== (const target_desc &other) const;
  51. bool operator!= (const target_desc &other) const
  52. {
  53. return !(*this == other);
  54. }
  55. #endif
  56. void accept (tdesc_element_visitor &v) const override;
  57. };
  58. /* Copy target description SRC to DEST. */
  59. void copy_target_description (struct target_desc *dest,
  60. const struct target_desc *src);
  61. /* Initialize TDESC, and then set its expedite_regs field to
  62. EXPEDITE_REGS. */
  63. void init_target_desc (struct target_desc *tdesc,
  64. const char **expedite_regs);
  65. /* Return the current inferior's target description. Never returns
  66. NULL. */
  67. const struct target_desc *current_target_desc (void);
  68. /* Return true if TDESC contains the feature described by string FEATURE.
  69. Return false otherwise. */
  70. bool tdesc_contains_feature (const target_desc *tdesc,
  71. const std::string &feature);
  72. #endif /* GDBSERVER_TDESC_H */