1 /* Target description definitions for remote server for GDB.
2 Copyright (C) 2012-2017 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 #include "arch/tdesc.h"
26 typedef struct reg *tdesc_reg_p;
27 DEF_VEC_P(tdesc_reg_p);
32 /* A target description. Inherit from tdesc_feature so that target_desc
33 can be used as tdesc_feature. */
35 struct target_desc : tdesc_feature
37 /* A vector of elements of register definitions that
38 describe the inferior's register set. */
39 VEC(tdesc_reg_p) *reg_defs;
41 /* The register cache size, in bytes. */
44 #ifndef IN_PROCESS_AGENT
45 /* An array of register names. These are the "expedite" registers:
46 registers whose values are sent along with stop replies. */
47 const char **expedite_regs = NULL;
49 /* Defines what to return when looking for the "target.xml" file in
50 response to qXfer:features:read. Its contents can either be
51 verbatim XML code (prefixed with a '@') or else the name of the
52 actual XML file to be used in place of "target.xml". */
53 const char *xmltarget = NULL;
57 : reg_defs (NULL), registers_size (0)
65 for (i = 0; VEC_iterate (tdesc_reg_p, reg_defs, i, reg); i++)
67 VEC_free (tdesc_reg_p, reg_defs);
70 bool operator== (const target_desc &other) const
72 if (VEC_length (tdesc_reg_p, reg_defs)
73 != VEC_length (tdesc_reg_p, other.reg_defs))
79 VEC_iterate (tdesc_reg_p, reg_defs, ix, reg);
83 = VEC_index (tdesc_reg_p, other.reg_defs, ix);
85 if (reg != reg2 && *reg != *reg2)
89 /* Compare expedite_regs. */
91 for (; expedite_regs[i] != NULL; i++)
93 if (strcmp (expedite_regs[i], other.expedite_regs[i]) != 0)
96 if (other.expedite_regs[i] != NULL)
99 if (strcmp (xmltarget, other.xmltarget) != 0)
105 bool operator!= (const target_desc &other) const
107 return !(*this == other);
112 /* Copy target description SRC to DEST. */
114 void copy_target_description (struct target_desc *dest,
115 const struct target_desc *src);
117 /* Initialize TDESC. */
119 void init_target_desc (struct target_desc *tdesc);
121 /* Return the current inferior's target description. Never returns
124 const struct target_desc *current_target_desc (void);