Commit | Line | Data |
---|---|---|
61baf725 | 1 | /* Copyright (C) 2012-2017 Free Software Foundation, Inc. |
3aee8918 PA |
2 | |
3 | This file is part of GDB. | |
4 | ||
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | #include "server.h" | |
19 | #include "tdesc.h" | |
20 | #include "regdef.h" | |
21 | ||
22 | void | |
23 | init_target_desc (struct target_desc *tdesc) | |
24 | { | |
25 | int offset, i; | |
f7000548 | 26 | struct reg *reg; |
3aee8918 PA |
27 | |
28 | offset = 0; | |
f7000548 | 29 | for (i = 0; VEC_iterate (tdesc_reg_p, tdesc->reg_defs, i, reg); i++) |
3aee8918 | 30 | { |
f7000548 YQ |
31 | reg->offset = offset; |
32 | offset += reg->size; | |
3aee8918 PA |
33 | } |
34 | ||
35 | tdesc->registers_size = offset / 8; | |
36 | ||
37 | /* Make sure PBUFSIZ is large enough to hold a full register | |
38 | packet. */ | |
38e08fca | 39 | gdb_assert (2 * tdesc->registers_size + 32 <= PBUFSIZ); |
3aee8918 PA |
40 | } |
41 | ||
42 | #ifndef IN_PROCESS_AGENT | |
43 | ||
f49ff000 | 44 | static const struct target_desc default_description {}; |
3aee8918 PA |
45 | |
46 | void | |
47 | copy_target_description (struct target_desc *dest, | |
48 | const struct target_desc *src) | |
49 | { | |
50 | dest->reg_defs = src->reg_defs; | |
3aee8918 PA |
51 | dest->expedite_regs = src->expedite_regs; |
52 | dest->registers_size = src->registers_size; | |
53 | dest->xmltarget = src->xmltarget; | |
54 | } | |
55 | ||
56 | const struct target_desc * | |
57 | current_target_desc (void) | |
58 | { | |
0bfdf32f | 59 | if (current_thread == NULL) |
3aee8918 PA |
60 | return &default_description; |
61 | ||
62 | return current_process ()->tdesc; | |
63 | } | |
3aee8918 | 64 | #endif |
f49ff000 YQ |
65 | |
66 | struct tdesc_type | |
67 | {}; | |
68 | ||
69 | /* See arch/tdesc.h. */ | |
70 | ||
71 | struct tdesc_feature * | |
72 | tdesc_create_feature (struct target_desc *tdesc, const char *name) | |
73 | { | |
74 | return tdesc; | |
75 | } | |
76 | ||
77 | /* See arch/tdesc.h. */ | |
78 | ||
79 | struct tdesc_type * | |
80 | tdesc_create_flags (struct tdesc_feature *feature, const char *name, | |
81 | int size) | |
82 | { | |
83 | return NULL; | |
84 | } | |
85 | ||
86 | /* See arch/tdesc.h. */ | |
87 | ||
88 | void | |
89 | tdesc_add_flag (struct tdesc_type *type, int start, | |
90 | const char *flag_name) | |
91 | {} | |
92 | ||
93 | /* See arch/tdesc.h. */ | |
94 | ||
95 | struct tdesc_type * | |
96 | tdesc_named_type (const struct tdesc_feature *feature, const char *id) | |
97 | { | |
98 | return NULL; | |
99 | } | |
100 | ||
101 | /* See arch/tdesc.h. */ | |
102 | ||
103 | struct tdesc_type * | |
104 | tdesc_create_union (struct tdesc_feature *feature, const char *id) | |
105 | { | |
106 | return NULL; | |
107 | } | |
108 | ||
109 | /* See arch/tdesc.h. */ | |
110 | ||
111 | struct tdesc_type * | |
112 | tdesc_create_struct (struct tdesc_feature *feature, const char *id) | |
113 | { | |
114 | return NULL; | |
115 | } | |
116 | ||
117 | /* See arch/tdesc.h. */ | |
118 | ||
119 | void | |
120 | tdesc_create_reg (struct tdesc_feature *feature, const char *name, | |
121 | int regnum, int save_restore, const char *group, | |
122 | int bitsize, const char *type) | |
123 | { | |
124 | struct target_desc *tdesc = (struct target_desc *) feature; | |
125 | ||
126 | while (VEC_length (tdesc_reg_p, tdesc->reg_defs) < regnum) | |
127 | { | |
128 | struct reg *reg = XCNEW (struct reg); | |
129 | ||
130 | reg->name = ""; | |
131 | reg->size = 0; | |
132 | VEC_safe_push (tdesc_reg_p, tdesc->reg_defs, reg); | |
133 | } | |
134 | ||
135 | gdb_assert (regnum == 0 | |
136 | || regnum == VEC_length (tdesc_reg_p, tdesc->reg_defs)); | |
137 | ||
138 | struct reg *reg = XCNEW (struct reg); | |
139 | ||
140 | reg->name = name; | |
141 | reg->size = bitsize; | |
142 | VEC_safe_push (tdesc_reg_p, tdesc->reg_defs, reg); | |
143 | } | |
144 | ||
145 | /* See arch/tdesc.h. */ | |
146 | ||
147 | struct tdesc_type * | |
148 | tdesc_create_vector (struct tdesc_feature *feature, const char *name, | |
149 | struct tdesc_type *field_type, int count) | |
150 | { | |
151 | return NULL; | |
152 | } | |
153 | ||
154 | void | |
155 | tdesc_add_bitfield (struct tdesc_type *type, const char *field_name, | |
156 | int start, int end) | |
157 | {} | |
158 | ||
159 | /* See arch/tdesc.h. */ | |
160 | ||
161 | void | |
162 | tdesc_add_field (struct tdesc_type *type, const char *field_name, | |
163 | struct tdesc_type *field_type) | |
164 | {} | |
165 | ||
166 | /* See arch/tdesc.h. */ | |
167 | ||
168 | void | |
169 | tdesc_set_struct_size (struct tdesc_type *type, int size) | |
170 | { | |
171 | } |