Move gdbserver tdesc header funcs to c file
[binutils-gdb.git] / gdb / gdbserver / tdesc.h
1 /* Target description definitions for remote server for GDB.
2 Copyright (C) 2012-2018 Free Software Foundation, Inc.
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
22 #include "common/tdesc.h"
23
24 #include "regdef.h"
25 #include <vector>
26
27 struct tdesc_feature
28 {};
29
30 /* A target description. Inherit from tdesc_feature so that target_desc
31 can be used as tdesc_feature. */
32
33 struct target_desc : tdesc_feature
34 {
35 /* A vector of elements of register definitions that
36 describe the inferior's register set. */
37 std::vector<struct reg *> reg_defs;
38
39 /* The register cache size, in bytes. */
40 int registers_size;
41
42 #ifndef IN_PROCESS_AGENT
43 /* An array of register names. These are the "expedite" registers:
44 registers whose values are sent along with stop replies. */
45 const char **expedite_regs = NULL;
46
47 /* Defines what to return when looking for the "target.xml" file in
48 response to qXfer:features:read. Its contents can either be
49 verbatim XML code (prefixed with a '@') or else the name of the
50 actual XML file to be used in place of "target.xml".
51
52 It can be NULL, then, its content is got from the following three
53 fields features, arch, and osabi in tdesc_get_features_xml. */
54 const char *xmltarget = NULL;
55
56 /* XML features in this target description. */
57 VEC (char_ptr) *features = NULL;
58
59 /* The value of <architecture> element in the XML, replying GDB. */
60 const char *arch = NULL;
61
62 /* The value of <osabi> element in the XML, replying GDB. */
63 const char *osabi = NULL;
64
65 public:
66 target_desc ()
67 : registers_size (0)
68 {}
69
70 ~target_desc ();
71
72 bool operator== (const target_desc &other) const;
73
74 bool operator!= (const target_desc &other) const
75 {
76 return !(*this == other);
77 }
78 #endif
79 };
80
81 /* Copy target description SRC to DEST. */
82
83 void copy_target_description (struct target_desc *dest,
84 const struct target_desc *src);
85
86 /* Initialize TDESC. */
87
88 void init_target_desc (struct target_desc *tdesc);
89
90 /* Return the current inferior's target description. Never returns
91 NULL. */
92
93 const struct target_desc *current_target_desc (void);
94
95 #ifndef IN_PROCESS_AGENT
96 const char *tdesc_get_features_xml (struct target_desc *tdesc);
97 #endif
98
99 #endif /* TDESC_H */