Remove features/i386/i386-*linux.c
[deliverable/binutils-gdb.git] / gdb / gdbserver / tdesc.h
CommitLineData
3aee8918 1/* Target description definitions for remote server for GDB.
61baf725 2 Copyright (C) 2012-2017 Free Software Foundation, Inc.
3aee8918
PA
3
4 This file is part of GDB.
5
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.
10
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.
15
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/>. */
18
19#ifndef TDESC_H
20#define TDESC_H
21
f49ff000
YQ
22#include "arch/tdesc.h"
23
0a188386 24#include "regdef.h"
3aee8918 25
f7000548
YQ
26typedef struct reg *tdesc_reg_p;
27DEF_VEC_P(tdesc_reg_p);
28
f49ff000
YQ
29struct tdesc_feature
30{};
31
32/* A target description. Inherit from tdesc_feature so that target_desc
33 can be used as tdesc_feature. */
3aee8918 34
f49ff000 35struct target_desc : tdesc_feature
3aee8918 36{
f7000548 37 /* A vector of elements of register definitions that
3aee8918 38 describe the inferior's register set. */
f7000548 39 VEC(tdesc_reg_p) *reg_defs;
3aee8918
PA
40
41 /* The register cache size, in bytes. */
42 int registers_size;
43
adc764e7 44#ifndef IN_PROCESS_AGENT
3aee8918
PA
45 /* An array of register names. These are the "expedite" registers:
46 registers whose values are sent along with stop replies. */
f49ff000 47 const char **expedite_regs = NULL;
3aee8918
PA
48
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
0abe8a89
YQ
52 actual XML file to be used in place of "target.xml".
53
54 It can be NULL, then, its content is got from the following three
55 fields features, arch, and osabi in tdesc_get_features_xml. */
f49ff000
YQ
56 const char *xmltarget = NULL;
57
0abe8a89
YQ
58 /* XML features in this target description. */
59 VEC (char_ptr) *features = NULL;
60
61 /* The value of <architecture> element in the XML, replying GDB. */
62 const char *arch = NULL;
63
64 /* The value of <osabi> element in the XML, replying GDB. */
65 const char *osabi = NULL;
66
f49ff000
YQ
67public:
68 target_desc ()
69 : reg_defs (NULL), registers_size (0)
70 {}
71
72 ~target_desc ()
73 {
74 int i;
75 struct reg *reg;
76
77 for (i = 0; VEC_iterate (tdesc_reg_p, reg_defs, i, reg); i++)
78 xfree (reg);
79 VEC_free (tdesc_reg_p, reg_defs);
0abe8a89
YQ
80
81 xfree ((char *) arch);
82 xfree ((char *) osabi);
83
84 char *f;
85
86 for (i = 0; VEC_iterate (char_ptr, features, i, f); i++)
87 xfree (f);
88 VEC_free (char_ptr, features);
f49ff000 89 }
0a188386
YQ
90
91 bool operator== (const target_desc &other) const
92 {
93 if (VEC_length (tdesc_reg_p, reg_defs)
94 != VEC_length (tdesc_reg_p, other.reg_defs))
95 return false;
96
97 struct reg *reg;
98
99 for (int ix = 0;
100 VEC_iterate (tdesc_reg_p, reg_defs, ix, reg);
101 ix++)
102 {
103 struct reg *reg2
104 = VEC_index (tdesc_reg_p, other.reg_defs, ix);
105
106 if (reg != reg2 && *reg != *reg2)
107 return false;
108 }
109
110 /* Compare expedite_regs. */
111 int i = 0;
112 for (; expedite_regs[i] != NULL; i++)
113 {
114 if (strcmp (expedite_regs[i], other.expedite_regs[i]) != 0)
115 return false;
116 }
117 if (other.expedite_regs[i] != NULL)
118 return false;
119
0a188386
YQ
120 return true;
121 }
122
123 bool operator!= (const target_desc &other) const
124 {
125 return !(*this == other);
126 }
adc764e7 127#endif
3aee8918
PA
128};
129
130/* Copy target description SRC to DEST. */
131
132void copy_target_description (struct target_desc *dest,
133 const struct target_desc *src);
134
135/* Initialize TDESC. */
136
137void init_target_desc (struct target_desc *tdesc);
138
139/* Return the current inferior's target description. Never returns
140 NULL. */
141
142const struct target_desc *current_target_desc (void);
143
0abe8a89 144#ifndef IN_PROCESS_AGENT
0abe8a89
YQ
145const char *tdesc_get_features_xml (struct target_desc *tdesc);
146#endif
147
3aee8918 148#endif /* TDESC_H */
This page took 0.330931 seconds and 4 git commands to generate.