OLD | NEW |
1 /* Low level interface to ptrace, for the remote server for GDB. | 1 /* Low level interface to ptrace, for the remote server for GDB. |
2 Copyright (C) 1995-1996, 1998-2012 Free Software Foundation, Inc. | 2 Copyright (C) 1995-1996, 1998-2012 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GDB. | 4 This file is part of GDB. |
5 | 5 |
6 This program is free software; you can redistribute it and/or modify | 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 | 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 | 8 the Free Software Foundation; either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 { | 112 { |
113 return (regno >= sparc_num_regs || sparc_regmap[regno] == -1); | 113 return (regno >= sparc_num_regs || sparc_regmap[regno] == -1); |
114 } | 114 } |
115 | 115 |
116 static void | 116 static void |
117 sparc_fill_gregset_to_stack (struct regcache *regcache, const void *buf) | 117 sparc_fill_gregset_to_stack (struct regcache *regcache, const void *buf) |
118 { | 118 { |
119 int i; | 119 int i; |
120 CORE_ADDR addr = 0; | 120 CORE_ADDR addr = 0; |
121 unsigned char tmp_reg_buf[8]; | 121 unsigned char tmp_reg_buf[8]; |
122 const int l0_regno = find_regno("l0"); | 122 const int l0_regno = find_regno ("l0"); |
123 const int i7_regno = l0_regno + 15; | 123 const int i7_regno = l0_regno + 15; |
124 | 124 |
125 /* These registers have to be stored in the stack. */ | 125 /* These registers have to be stored in the stack. */ |
126 memcpy(&addr, ((char *) buf) + sparc_regmap[find_regno("sp")], sizeof(addr)); | 126 memcpy (&addr, |
| 127 » ((char *) buf) + sparc_regmap[find_regno ("sp")], |
| 128 » sizeof (addr)); |
127 | 129 |
128 addr += BIAS; | 130 addr += BIAS; |
129 | 131 |
130 for (i = l0_regno; i <= i7_regno; i++) | 132 for (i = l0_regno; i <= i7_regno; i++) |
131 { | 133 { |
132 collect_register (regcache, i, tmp_reg_buf); | 134 collect_register (regcache, i, tmp_reg_buf); |
133 (*the_target->write_memory) (addr, tmp_reg_buf, sizeof(tmp_reg_buf)); | 135 (*the_target->write_memory) (addr, tmp_reg_buf, sizeof (tmp_reg_buf)); |
134 addr += sizeof(tmp_reg_buf); | 136 addr += sizeof (tmp_reg_buf); |
135 } | 137 } |
136 } | 138 } |
137 | 139 |
138 static void | 140 static void |
139 sparc_fill_gregset (struct regcache *regcache, void *buf) | 141 sparc_fill_gregset (struct regcache *regcache, void *buf) |
140 { | 142 { |
141 int i; | 143 int i; |
142 int range; | 144 int range; |
143 | 145 |
144 for (range = 0; range < N_GREGS_RANGES; range++) | 146 for (range = 0; range < N_GREGS_RANGES; range++) |
(...skipping 17 matching lines...) Expand all Loading... |
162 collect_register (regcache, i, ((char *) buf) + sparc_regmap[i]); | 164 collect_register (regcache, i, ((char *) buf) + sparc_regmap[i]); |
163 | 165 |
164 } | 166 } |
165 | 167 |
166 static void | 168 static void |
167 sparc_store_gregset_from_stack (struct regcache *regcache, const void *buf) | 169 sparc_store_gregset_from_stack (struct regcache *regcache, const void *buf) |
168 { | 170 { |
169 int i; | 171 int i; |
170 CORE_ADDR addr = 0; | 172 CORE_ADDR addr = 0; |
171 unsigned char tmp_reg_buf[8]; | 173 unsigned char tmp_reg_buf[8]; |
172 const int l0_regno = find_regno("l0"); | 174 const int l0_regno = find_regno ("l0"); |
173 const int i7_regno = l0_regno + 15; | 175 const int i7_regno = l0_regno + 15; |
174 | 176 |
175 /* These registers have to be obtained from the stack. */ | 177 /* These registers have to be obtained from the stack. */ |
176 memcpy(&addr, ((char *) buf) + sparc_regmap[find_regno("sp")], sizeof(addr)); | 178 memcpy (&addr, |
| 179 » ((char *) buf) + sparc_regmap[find_regno ("sp")], |
| 180 » sizeof (addr)); |
177 | 181 |
178 addr += BIAS; | 182 addr += BIAS; |
179 | 183 |
180 for (i = l0_regno; i <= i7_regno; i++) | 184 for (i = l0_regno; i <= i7_regno; i++) |
181 { | 185 { |
182 (*the_target->read_memory) (addr, tmp_reg_buf, sizeof(tmp_reg_buf)); | 186 (*the_target->read_memory) (addr, tmp_reg_buf, sizeof (tmp_reg_buf)); |
183 supply_register (regcache, i, tmp_reg_buf); | 187 supply_register (regcache, i, tmp_reg_buf); |
184 addr += sizeof(tmp_reg_buf); | 188 addr += sizeof (tmp_reg_buf); |
185 } | 189 } |
186 } | 190 } |
187 | 191 |
188 static void | 192 static void |
189 sparc_store_gregset (struct regcache *regcache, const void *buf) | 193 sparc_store_gregset (struct regcache *regcache, const void *buf) |
190 { | 194 { |
191 int i; | 195 int i; |
192 char zerobuf[8]; | 196 char zerobuf[8]; |
193 int range; | 197 int range; |
194 | 198 |
195 memset (zerobuf, 0, sizeof(zerobuf)); | 199 memset (zerobuf, 0, sizeof (zerobuf)); |
196 | 200 |
197 for (range = 0; range < N_GREGS_RANGES; range++) | 201 for (range = 0; range < N_GREGS_RANGES; range++) |
198 for (i = gregs_ranges[range].regno_start; | 202 for (i = gregs_ranges[range].regno_start; |
199 i <= gregs_ranges[range].regno_end; i++) | 203 i <= gregs_ranges[range].regno_end; i++) |
200 if (sparc_regmap[i] != -1) | 204 if (sparc_regmap[i] != -1) |
201 supply_register (regcache, i, ((char *) buf) + sparc_regmap[i]); | 205 supply_register (regcache, i, ((char *) buf) + sparc_regmap[i]); |
202 else | 206 else |
203 supply_register (regcache, i, zerobuf); | 207 supply_register (regcache, i, zerobuf); |
204 | 208 |
205 sparc_store_gregset_from_stack (regcache, buf); | 209 sparc_store_gregset_from_stack (regcache, buf); |
(...skipping 28 matching lines...) Expand all Loading... |
234 0x91, 0xd0, 0x20, 0x01 | 238 0x91, 0xd0, 0x20, 0x01 |
235 }; | 239 }; |
236 #define sparc_breakpoint_len INSN_SIZE | 240 #define sparc_breakpoint_len INSN_SIZE |
237 | 241 |
238 | 242 |
239 static int | 243 static int |
240 sparc_breakpoint_at (CORE_ADDR where) | 244 sparc_breakpoint_at (CORE_ADDR where) |
241 { | 245 { |
242 unsigned char insn[INSN_SIZE]; | 246 unsigned char insn[INSN_SIZE]; |
243 | 247 |
244 (*the_target->read_memory) (where, (unsigned char *) insn, sizeof(insn)); | 248 (*the_target->read_memory) (where, (unsigned char *) insn, sizeof (insn)); |
245 | 249 |
246 if (memcmp(sparc_breakpoint, insn, sizeof(insn)) == 0) | 250 if (memcmp (sparc_breakpoint, insn, sizeof (insn)) == 0) |
247 return 1; | 251 return 1; |
248 | 252 |
249 /* If necessary, recognize more trap instructions here. GDB only | 253 /* If necessary, recognize more trap instructions here. GDB only |
250 uses TRAP Always. */ | 254 uses TRAP Always. */ |
251 | 255 |
252 return 0; | 256 return 0; |
253 } | 257 } |
254 | 258 |
255 /* We only place breakpoints in empty marker functions, and thread locking | 259 /* We only place breakpoints in empty marker functions, and thread locking |
256 is outside of the function. So rather than importing software single-step, | 260 is outside of the function. So rather than importing software single-step, |
(...skipping 17 matching lines...) Expand all Loading... |
274 FP_REGS, | 278 FP_REGS, |
275 sparc_fill_fpregset, sparc_store_fpregset }, | 279 sparc_fill_fpregset, sparc_store_fpregset }, |
276 { 0, 0, 0, -1, -1, NULL, NULL } | 280 { 0, 0, 0, -1, -1, NULL, NULL } |
277 }; | 281 }; |
278 | 282 |
279 struct linux_target_ops the_low_target = { | 283 struct linux_target_ops the_low_target = { |
280 init_registers_sparc64, | 284 init_registers_sparc64, |
281 sparc_num_regs, | 285 sparc_num_regs, |
282 /* No regmap needs to be provided since this impl. doesn't use USRREGS. */ | 286 /* No regmap needs to be provided since this impl. doesn't use USRREGS. */ |
283 NULL, | 287 NULL, |
| 288 NULL, |
284 sparc_cannot_fetch_register, | 289 sparc_cannot_fetch_register, |
285 sparc_cannot_store_register, | 290 sparc_cannot_store_register, |
| 291 NULL, /* fetch_register */ |
286 sparc_get_pc, | 292 sparc_get_pc, |
287 /* No sparc_set_pc is needed. */ | 293 /* No sparc_set_pc is needed. */ |
288 NULL, | 294 NULL, |
289 (const unsigned char *) sparc_breakpoint, | 295 (const unsigned char *) sparc_breakpoint, |
290 sparc_breakpoint_len, | 296 sparc_breakpoint_len, |
291 sparc_reinsert_addr, | 297 sparc_reinsert_addr, |
292 0, | 298 0, |
293 sparc_breakpoint_at, | 299 sparc_breakpoint_at, |
294 NULL, NULL, NULL, NULL, | 300 NULL, NULL, NULL, NULL, |
295 NULL, NULL | 301 NULL, NULL |
296 }; | 302 }; |
OLD | NEW |