* Makefile.tpl: Move .NOEXPORT, MAKEOVERRIDES up. Delete unused
[deliverable/binutils-gdb.git] / gdb / regcache.c
CommitLineData
32178cab 1/* Cache and manage the values of registers for GDB, the GNU debugger.
3fadccb3
AC
2
3 Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000,
4 2001, 2002 Free Software Foundation, Inc.
32178cab
MS
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23#include "defs.h"
32178cab
MS
24#include "inferior.h"
25#include "target.h"
26#include "gdbarch.h"
705152c5 27#include "gdbcmd.h"
4e052eda 28#include "regcache.h"
b59ff9d5 29#include "reggroups.h"
61a0eb5b 30#include "gdb_assert.h"
b66d6d2e 31#include "gdb_string.h"
af030b9a 32#include "gdbcmd.h" /* For maintenanceprintlist. */
32178cab
MS
33
34/*
35 * DATA STRUCTURE
36 *
37 * Here is the actual register cache.
38 */
39
3fadccb3
AC
40/* Per-architecture object describing the layout of a register cache.
41 Computed once when the architecture is created */
42
43struct gdbarch_data *regcache_descr_handle;
44
45struct regcache_descr
46{
47 /* The architecture this descriptor belongs to. */
48 struct gdbarch *gdbarch;
49
50 /* Is this a ``legacy'' register cache? Such caches reserve space
51 for raw and pseudo registers and allow access to both. */
52 int legacy_p;
53
54 /* The raw register cache. This should contain just [0
55 .. NUM_RAW_REGISTERS). However, for older targets, it contains
56 space for the full [0 .. NUM_RAW_REGISTERS +
57 NUM_PSEUDO_REGISTERS). */
58 int nr_raw_registers;
59 long sizeof_raw_registers;
60 long sizeof_raw_register_valid_p;
61
d138e37a
AC
62 /* The cooked register space. Each cooked register in the range
63 [0..NR_RAW_REGISTERS) is direct-mapped onto the corresponding raw
64 register. The remaining [NR_RAW_REGISTERS
65 .. NR_COOKED_REGISTERS) (a.k.a. pseudo regiters) are mapped onto
66 both raw registers and memory by the architecture methods
67 gdbarch_register_read and gdbarch_register_write. */
68 int nr_cooked_registers;
067df2e5
AC
69 long sizeof_cooked_registers;
70 long sizeof_cooked_register_valid_p;
d138e37a
AC
71
72 /* Offset and size (in 8 bit bytes), of reach register in the
73 register cache. All registers (including those in the range
74 [NR_RAW_REGISTERS .. NR_COOKED_REGISTERS) are given an offset.
75 Assigning all registers an offset makes it possible to keep
76 legacy code, such as that found in read_register_bytes() and
77 write_register_bytes() working. */
3fadccb3 78 long *register_offset;
3fadccb3 79 long *sizeof_register;
3fadccb3 80
d138e37a
AC
81 /* Useful constant. Largest of all the registers. */
82 long max_register_size;
bb425013
AC
83
84 /* Cached table containing the type of each register. */
85 struct type **register_type;
3fadccb3
AC
86};
87
bb425013
AC
88void
89init_legacy_regcache_descr (struct gdbarch *gdbarch,
90 struct regcache_descr *descr)
3fadccb3
AC
91{
92 int i;
3fadccb3
AC
93 /* FIXME: cagney/2002-05-11: gdbarch_data() should take that
94 ``gdbarch'' as a parameter. */
95 gdb_assert (gdbarch != NULL);
96
3fadccb3 97 /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers
067df2e5
AC
98 in the register cache. Unfortunatly some architectures still
99 rely on this and the pseudo_register_write() method. */
d138e37a 100 descr->nr_raw_registers = descr->nr_cooked_registers;
067df2e5
AC
101 descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p;
102
103 /* Compute the offset of each register. Legacy architectures define
104 REGISTER_BYTE() so use that. */
105 /* FIXME: cagney/2002-11-07: Instead of using REGISTER_BYTE() this
106 code should, as is done in init_regcache_descr(), compute the
107 offets at runtime. This currently isn't possible as some ISAs
108 define overlapping register regions - see the mess in
109 read_register_bytes() and write_register_bytes() registers. */
d138e37a
AC
110 descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long);
111 descr->register_offset = XCALLOC (descr->nr_cooked_registers, long);
3fadccb3 112 descr->max_register_size = 0;
d138e37a 113 for (i = 0; i < descr->nr_cooked_registers; i++)
3fadccb3 114 {
067df2e5
AC
115 /* FIXME: cagney/2001-12-04: This code shouldn't need to use
116 REGISTER_BYTE(). Unfortunatly, legacy code likes to lay the
117 buffer out so that certain registers just happen to overlap.
118 Ulgh! New targets use gdbarch's register read/write and
119 entirely avoid this uglyness. */
3fadccb3
AC
120 descr->register_offset[i] = REGISTER_BYTE (i);
121 descr->sizeof_register[i] = REGISTER_RAW_SIZE (i);
122 if (descr->max_register_size < REGISTER_RAW_SIZE (i))
123 descr->max_register_size = REGISTER_RAW_SIZE (i);
0ed04cce
AC
124 if (descr->max_register_size < REGISTER_VIRTUAL_SIZE (i))
125 descr->max_register_size = REGISTER_VIRTUAL_SIZE (i);
3fadccb3
AC
126 }
127
067df2e5
AC
128 /* Compute the real size of the register buffer. Start out by
129 trusting REGISTER_BYTES, but then adjust it upwards should that
130 be found to not be sufficient. */
131 /* FIXME: cagney/2002-11-05: Instead of using REGISTER_BYTES, this
132 code should, as is done in init_regcache_descr(), compute the
133 total number of register bytes using the accumulated offsets. */
134 descr->sizeof_cooked_registers = REGISTER_BYTES; /* OK use. */
d138e37a 135 for (i = 0; i < descr->nr_cooked_registers; i++)
3fadccb3
AC
136 {
137 long regend;
138 /* Keep extending the buffer so that there is always enough
139 space for all registers. The comparison is necessary since
140 legacy code is free to put registers in random places in the
141 buffer separated by holes. Once REGISTER_BYTE() is killed
142 this can be greatly simplified. */
3fadccb3 143 regend = descr->register_offset[i] + descr->sizeof_register[i];
067df2e5
AC
144 if (descr->sizeof_cooked_registers < regend)
145 descr->sizeof_cooked_registers = regend;
3fadccb3 146 }
067df2e5
AC
147 /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers
148 in the register cache. Unfortunatly some architectures still
149 rely on this and the pseudo_register_write() method. */
150 descr->sizeof_raw_registers = descr->sizeof_cooked_registers;
3fadccb3
AC
151}
152
153static void *
154init_regcache_descr (struct gdbarch *gdbarch)
155{
156 int i;
157 struct regcache_descr *descr;
158 gdb_assert (gdbarch != NULL);
159
bb425013
AC
160 /* Create an initial, zero filled, table. */
161 descr = XCALLOC (1, struct regcache_descr);
3fadccb3 162 descr->gdbarch = gdbarch;
3fadccb3 163
d138e37a
AC
164 /* Total size of the register space. The raw registers are mapped
165 directly onto the raw register cache while the pseudo's are
3fadccb3 166 either mapped onto raw-registers or memory. */
d138e37a 167 descr->nr_cooked_registers = NUM_REGS + NUM_PSEUDO_REGS;
067df2e5 168 descr->sizeof_cooked_register_valid_p = NUM_REGS + NUM_PSEUDO_REGS;
3fadccb3 169
bb425013
AC
170 /* Fill in a table of register types. */
171 descr->register_type = XCALLOC (descr->nr_cooked_registers,
172 struct type *);
173 for (i = 0; i < descr->nr_cooked_registers; i++)
174 {
35cac7cf
AC
175 if (gdbarch_register_type_p (gdbarch))
176 {
177 gdb_assert (!REGISTER_VIRTUAL_TYPE_P ()); /* OK */
178 descr->register_type[i] = gdbarch_register_type (gdbarch, i);
179 }
180 else
181 descr->register_type[i] = REGISTER_VIRTUAL_TYPE (i); /* OK */
bb425013
AC
182 }
183
184 /* If an old style architecture, fill in the remainder of the
185 register cache descriptor using the register macros. */
186 if (!gdbarch_pseudo_register_read_p (gdbarch)
35cac7cf
AC
187 && !gdbarch_pseudo_register_write_p (gdbarch)
188 && !gdbarch_register_type_p (gdbarch))
bb425013
AC
189 {
190 descr->legacy_p = 1;
191 init_legacy_regcache_descr (gdbarch, descr);
192 return descr;
193 }
194
3fadccb3
AC
195 /* Construct a strictly RAW register cache. Don't allow pseudo's
196 into the register cache. */
197 descr->nr_raw_registers = NUM_REGS;
53826de9
AC
198
199 /* FIXME: cagney/2002-08-13: Overallocate the register_valid_p
200 array. This pretects GDB from erant code that accesses elements
201 of the global register_valid_p[] array in the range [NUM_REGS
202 .. NUM_REGS + NUM_PSEUDO_REGS). */
067df2e5 203 descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p;
3fadccb3 204
067df2e5 205 /* Lay out the register cache.
3fadccb3 206
bb425013
AC
207 NOTE: cagney/2002-05-22: Only register_type() is used when
208 constructing the register cache. It is assumed that the
209 register's raw size, virtual size and type length are all the
210 same. */
3fadccb3
AC
211
212 {
213 long offset = 0;
d138e37a
AC
214 descr->sizeof_register = XCALLOC (descr->nr_cooked_registers, long);
215 descr->register_offset = XCALLOC (descr->nr_cooked_registers, long);
3fadccb3 216 descr->max_register_size = 0;
d138e37a 217 for (i = 0; i < descr->nr_cooked_registers; i++)
3fadccb3 218 {
bb425013 219 descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
3fadccb3
AC
220 descr->register_offset[i] = offset;
221 offset += descr->sizeof_register[i];
222 if (descr->max_register_size < descr->sizeof_register[i])
223 descr->max_register_size = descr->sizeof_register[i];
224 }
225 /* Set the real size of the register cache buffer. */
067df2e5 226 descr->sizeof_cooked_registers = offset;
3fadccb3
AC
227 }
228
067df2e5
AC
229 /* FIXME: cagney/2002-05-22: Should only need to allocate space for
230 the raw registers. Unfortunatly some code still accesses the
231 register array directly using the global registers[]. Until that
232 code has been purged, play safe and over allocating the register
233 buffer. Ulgh! */
234 descr->sizeof_raw_registers = descr->sizeof_cooked_registers;
235
3fadccb3
AC
236#if 0
237 /* Sanity check. Confirm that the assumptions about gdbarch are
238 true. The REGCACHE_DESCR_HANDLE is set before doing the checks
239 so that targets using the generic methods supplied by regcache
240 don't go into infinite recursion trying to, again, create the
241 regcache. */
242 set_gdbarch_data (gdbarch, regcache_descr_handle, descr);
d138e37a 243 for (i = 0; i < descr->nr_cooked_registers; i++)
3fadccb3
AC
244 {
245 gdb_assert (descr->sizeof_register[i] == REGISTER_RAW_SIZE (i));
246 gdb_assert (descr->sizeof_register[i] == REGISTER_VIRTUAL_SIZE (i));
247 gdb_assert (descr->register_offset[i] == REGISTER_BYTE (i));
248 }
249 /* gdb_assert (descr->sizeof_raw_registers == REGISTER_BYTES (i)); */
250#endif
251
252 return descr;
253}
254
255static struct regcache_descr *
256regcache_descr (struct gdbarch *gdbarch)
257{
258 return gdbarch_data (gdbarch, regcache_descr_handle);
259}
260
261static void
262xfree_regcache_descr (struct gdbarch *gdbarch, void *ptr)
263{
264 struct regcache_descr *descr = ptr;
265 if (descr == NULL)
266 return;
267 xfree (descr->register_offset);
268 xfree (descr->sizeof_register);
269 descr->register_offset = NULL;
270 descr->sizeof_register = NULL;
271 xfree (descr);
272}
273
bb425013
AC
274/* Utility functions returning useful register attributes stored in
275 the regcache descr. */
276
277struct type *
278register_type (struct gdbarch *gdbarch, int regnum)
279{
280 struct regcache_descr *descr = regcache_descr (gdbarch);
281 gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
282 return descr->register_type[regnum];
283}
284
0ed04cce
AC
285/* Utility functions returning useful register attributes stored in
286 the regcache descr. */
287
288int
289max_register_size (struct gdbarch *gdbarch)
290{
291 struct regcache_descr *descr = regcache_descr (gdbarch);
292 return descr->max_register_size;
293}
294
a0ed5532
AC
295int
296legacy_max_register_raw_size (void)
297{
298 if (DEPRECATED_MAX_REGISTER_RAW_SIZE_P ())
299 return DEPRECATED_MAX_REGISTER_RAW_SIZE;
300 else
301 return max_register_size (current_gdbarch);
302}
303
304int
305legacy_max_register_virtual_size (void)
306{
307 if (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P ())
308 return DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE;
309 else
310 return max_register_size (current_gdbarch);
311}
312
08a617da
AC
313int
314register_size (struct gdbarch *gdbarch, int regnum)
315{
316 struct regcache_descr *descr = regcache_descr (gdbarch);
317 int size;
318 gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
319 size = descr->sizeof_register[regnum];
320 gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
321 gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
322 return size;
323}
324
3fadccb3
AC
325/* The register cache for storing raw register values. */
326
327struct regcache
328{
329 struct regcache_descr *descr;
51b1fe4e
AC
330 /* The register buffers. A read-only register cache can hold the
331 full [0 .. NUM_REGS + NUM_PSEUDO_REGS) while a read/write
332 register cache can only hold [0 .. NUM_REGS). */
333 char *registers;
334 char *register_valid_p;
2d28509a
AC
335 /* Is this a read-only cache? A read-only cache is used for saving
336 the target's register state (e.g, across an inferior function
337 call or just before forcing a function return). A read-only
338 cache can only be updated via the methods regcache_dup() and
339 regcache_cpy(). The actual contents are determined by the
340 reggroup_save and reggroup_restore methods. */
341 int readonly_p;
3fadccb3
AC
342};
343
344struct regcache *
345regcache_xmalloc (struct gdbarch *gdbarch)
346{
347 struct regcache_descr *descr;
348 struct regcache *regcache;
349 gdb_assert (gdbarch != NULL);
350 descr = regcache_descr (gdbarch);
351 regcache = XMALLOC (struct regcache);
352 regcache->descr = descr;
51b1fe4e 353 regcache->registers
3fadccb3 354 = XCALLOC (descr->sizeof_raw_registers, char);
51b1fe4e 355 regcache->register_valid_p
3fadccb3 356 = XCALLOC (descr->sizeof_raw_register_valid_p, char);
2d28509a 357 regcache->readonly_p = 1;
3fadccb3
AC
358 return regcache;
359}
360
361void
362regcache_xfree (struct regcache *regcache)
363{
364 if (regcache == NULL)
365 return;
51b1fe4e
AC
366 xfree (regcache->registers);
367 xfree (regcache->register_valid_p);
3fadccb3
AC
368 xfree (regcache);
369}
370
36160dc4
AC
371void
372do_regcache_xfree (void *data)
373{
374 regcache_xfree (data);
375}
376
377struct cleanup *
378make_cleanup_regcache_xfree (struct regcache *regcache)
379{
380 return make_cleanup (do_regcache_xfree, regcache);
381}
382
51b1fe4e
AC
383/* Return a pointer to register REGNUM's buffer cache. */
384
385static char *
386register_buffer (struct regcache *regcache, int regnum)
387{
388 return regcache->registers + regcache->descr->register_offset[regnum];
389}
390
2d28509a 391void
5602984a
AC
392regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read,
393 void *src)
2d28509a
AC
394{
395 struct gdbarch *gdbarch = dst->descr->gdbarch;
5602984a 396 void *buf = alloca (max_register_size (gdbarch));
2d28509a 397 int regnum;
2d28509a 398 /* The DST should be `read-only', if it wasn't then the save would
5602984a 399 end up trying to write the register values back out to the
2d28509a 400 target. */
2d28509a
AC
401 gdb_assert (dst->readonly_p);
402 /* Clear the dest. */
403 memset (dst->registers, 0, dst->descr->sizeof_cooked_registers);
404 memset (dst->register_valid_p, 0, dst->descr->sizeof_cooked_register_valid_p);
405 /* Copy over any registers (identified by their membership in the
5602984a
AC
406 save_reggroup) and mark them as valid. The full [0 .. NUM_REGS +
407 NUM_PSEUDO_REGS) range is checked since some architectures need
408 to save/restore `cooked' registers that live in memory. */
2d28509a
AC
409 for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++)
410 {
411 if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup))
412 {
5602984a
AC
413 int valid = cooked_read (src, regnum, buf);
414 if (valid)
415 {
416 memcpy (register_buffer (dst, regnum), buf,
417 register_size (gdbarch, regnum));
418 dst->register_valid_p[regnum] = 1;
419 }
2d28509a
AC
420 }
421 }
422}
423
424void
5602984a
AC
425regcache_restore (struct regcache *dst,
426 regcache_cooked_read_ftype *cooked_read,
427 void *src)
2d28509a
AC
428{
429 struct gdbarch *gdbarch = dst->descr->gdbarch;
5602984a 430 void *buf = alloca (max_register_size (gdbarch));
2d28509a 431 int regnum;
5602984a
AC
432 /* The dst had better not be read-only. If it is, the `restore'
433 doesn't make much sense. */
2d28509a 434 gdb_assert (!dst->readonly_p);
2d28509a 435 /* Copy over any registers, being careful to only restore those that
5602984a
AC
436 were both saved and need to be restored. The full [0 .. NUM_REGS
437 + NUM_PSEUDO_REGS) range is checked since some architectures need
438 to save/restore `cooked' registers that live in memory. */
439 for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++)
2d28509a 440 {
5602984a 441 if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
2d28509a 442 {
5602984a
AC
443 int valid = cooked_read (src, regnum, buf);
444 if (valid)
445 regcache_cooked_write (dst, regnum, buf);
2d28509a
AC
446 }
447 }
448}
449
5602984a
AC
450static int
451do_cooked_read (void *src, int regnum, void *buf)
452{
453 struct regcache *regcache = src;
454 if (!regcache_valid_p (regcache, regnum)
455 && regcache->readonly_p)
456 /* Don't even think about fetching a register from a read-only
457 cache when the register isn't yet valid. There isn't a target
458 from which the register value can be fetched. */
459 return 0;
460 regcache_cooked_read (regcache, regnum, buf);
461 return 1;
462}
463
464
3fadccb3
AC
465void
466regcache_cpy (struct regcache *dst, struct regcache *src)
467{
468 int i;
469 char *buf;
470 gdb_assert (src != NULL && dst != NULL);
471 gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
472 gdb_assert (src != dst);
2d28509a
AC
473 gdb_assert (src->readonly_p || dst->readonly_p);
474 if (!src->readonly_p)
5602984a 475 regcache_save (dst, do_cooked_read, src);
2d28509a 476 else if (!dst->readonly_p)
5602984a 477 regcache_restore (dst, do_cooked_read, src);
2d28509a
AC
478 else
479 regcache_cpy_no_passthrough (dst, src);
3fadccb3
AC
480}
481
482void
483regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src)
484{
485 int i;
486 gdb_assert (src != NULL && dst != NULL);
487 gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
488 /* NOTE: cagney/2002-05-17: Don't let the caller do a no-passthrough
489 move of data into the current_regcache(). Doing this would be
490 silly - it would mean that valid_p would be completly invalid. */
491 gdb_assert (dst != current_regcache);
51b1fe4e
AC
492 memcpy (dst->registers, src->registers, dst->descr->sizeof_raw_registers);
493 memcpy (dst->register_valid_p, src->register_valid_p,
3fadccb3
AC
494 dst->descr->sizeof_raw_register_valid_p);
495}
496
497struct regcache *
498regcache_dup (struct regcache *src)
499{
500 struct regcache *newbuf;
501 gdb_assert (current_regcache != NULL);
502 newbuf = regcache_xmalloc (src->descr->gdbarch);
503 regcache_cpy (newbuf, src);
504 return newbuf;
505}
506
507struct regcache *
508regcache_dup_no_passthrough (struct regcache *src)
509{
510 struct regcache *newbuf;
511 gdb_assert (current_regcache != NULL);
512 newbuf = regcache_xmalloc (src->descr->gdbarch);
513 regcache_cpy_no_passthrough (newbuf, src);
514 return newbuf;
515}
516
517int
518regcache_valid_p (struct regcache *regcache, int regnum)
519{
520 gdb_assert (regcache != NULL);
521 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
51b1fe4e 522 return regcache->register_valid_p[regnum];
3fadccb3
AC
523}
524
3fadccb3
AC
525char *
526deprecated_grub_regcache_for_registers (struct regcache *regcache)
527{
51b1fe4e 528 return regcache->registers;
3fadccb3
AC
529}
530
531char *
532deprecated_grub_regcache_for_register_valid (struct regcache *regcache)
533{
51b1fe4e 534 return regcache->register_valid_p;
3fadccb3
AC
535}
536
537/* Global structure containing the current regcache. */
538/* FIXME: cagney/2002-05-11: The two global arrays registers[] and
8262ee23 539 deprecated_register_valid[] currently point into this structure. */
3fadccb3
AC
540struct regcache *current_regcache;
541
5ebd2499 542/* NOTE: this is a write-through cache. There is no "dirty" bit for
32178cab
MS
543 recording if the register values have been changed (eg. by the
544 user). Therefore all registers must be written back to the
545 target when appropriate. */
546
547/* REGISTERS contains the cached register values (in target byte order). */
548
524d7c18 549char *deprecated_registers;
32178cab 550
8262ee23 551/* DEPRECATED_REGISTER_VALID is 0 if the register needs to be fetched,
32178cab
MS
552 1 if it has been fetched, and
553 -1 if the register value was not available.
c97dcfc7
AC
554
555 "Not available" indicates that the target is not not able to supply
556 the register at this state. The register may become available at a
557 later time (after the next resume). This often occures when GDB is
558 manipulating a target that contains only a snapshot of the entire
559 system being debugged - some of the registers in such a system may
560 not have been saved. */
32178cab 561
8262ee23 562signed char *deprecated_register_valid;
32178cab 563
39f77062 564/* The thread/process associated with the current set of registers. */
32178cab 565
39f77062 566static ptid_t registers_ptid;
32178cab
MS
567
568/*
569 * FUNCTIONS:
570 */
571
572/* REGISTER_CACHED()
573
574 Returns 0 if the value is not in the cache (needs fetch).
575 >0 if the value is in the cache.
576 <0 if the value is permanently unavailable (don't ask again). */
577
578int
579register_cached (int regnum)
580{
8262ee23 581 return deprecated_register_valid[regnum];
32178cab
MS
582}
583
7302a204
ND
584/* Record that REGNUM's value is cached if STATE is >0, uncached but
585 fetchable if STATE is 0, and uncached and unfetchable if STATE is <0. */
586
587void
588set_register_cached (int regnum, int state)
589{
53826de9
AC
590 gdb_assert (regnum >= 0);
591 gdb_assert (regnum < current_regcache->descr->nr_raw_registers);
51b1fe4e 592 current_regcache->register_valid_p[regnum] = state;
7302a204
ND
593}
594
595/* Return whether register REGNUM is a real register. */
596
597static int
598real_register (int regnum)
599{
600 return regnum >= 0 && regnum < NUM_REGS;
601}
602
32178cab
MS
603/* Low level examining and depositing of registers.
604
605 The caller is responsible for making sure that the inferior is
606 stopped before calling the fetching routines, or it will get
607 garbage. (a change from GDB version 3, in which the caller got the
608 value from the last stop). */
609
610/* REGISTERS_CHANGED ()
611
612 Indicate that registers may have changed, so invalidate the cache. */
613
614void
615registers_changed (void)
616{
617 int i;
32178cab 618
39f77062 619 registers_ptid = pid_to_ptid (-1);
32178cab
MS
620
621 /* Force cleanup of any alloca areas if using C alloca instead of
622 a builtin alloca. This particular call is used to clean up
623 areas allocated by low level target code which may build up
624 during lengthy interactions between gdb and the target before
625 gdb gives control to the user (ie watchpoints). */
626 alloca (0);
627
53826de9 628 for (i = 0; i < current_regcache->descr->nr_raw_registers; i++)
7302a204 629 set_register_cached (i, 0);
32178cab
MS
630
631 if (registers_changed_hook)
632 registers_changed_hook ();
633}
634
2b9e5f3f 635/* DEPRECATED_REGISTERS_FETCHED ()
32178cab
MS
636
637 Indicate that all registers have been fetched, so mark them all valid. */
638
31e9866e
AC
639/* NOTE: cagney/2001-12-04: This function does not set valid on the
640 pseudo-register range since pseudo registers are always supplied
641 using supply_register(). */
642/* FIXME: cagney/2001-12-04: This function is DEPRECATED. The target
643 code was blatting the registers[] array and then calling this.
644 Since targets should only be using supply_register() the need for
645 this function/hack is eliminated. */
32178cab
MS
646
647void
2b9e5f3f 648deprecated_registers_fetched (void)
32178cab
MS
649{
650 int i;
32178cab 651
a728f042 652 for (i = 0; i < NUM_REGS; i++)
7302a204 653 set_register_cached (i, 1);
fcdc5976 654 /* Do not assume that the pseudo-regs have also been fetched.
31e9866e 655 Fetching all real regs NEVER accounts for pseudo-regs. */
32178cab
MS
656}
657
73937e03
AC
658/* deprecated_read_register_bytes and deprecated_write_register_bytes
659 are generally a *BAD* idea. They are inefficient because they need
660 to check for partial updates, which can only be done by scanning
661 through all of the registers and seeing if the bytes that are being
662 read/written fall inside of an invalid register. [The main reason
663 this is necessary is that register sizes can vary, so a simple
664 index won't suffice.] It is far better to call read_register_gen
665 and write_register_gen if you want to get at the raw register
666 contents, as it only takes a regnum as an argument, and therefore
667 can't do a partial register update.
32178cab
MS
668
669 Prior to the recent fixes to check for partial updates, both read
73937e03
AC
670 and deprecated_write_register_bytes always checked to see if any
671 registers were stale, and then called target_fetch_registers (-1)
672 to update the whole set. This caused really slowed things down for
673 remote targets. */
32178cab
MS
674
675/* Copy INLEN bytes of consecutive data from registers
676 starting with the INREGBYTE'th byte of register data
677 into memory at MYADDR. */
678
679void
73937e03 680deprecated_read_register_bytes (int in_start, char *in_buf, int in_len)
32178cab 681{
61a0eb5b 682 int in_end = in_start + in_len;
5ebd2499 683 int regnum;
61a0eb5b 684 char *reg_buf = alloca (MAX_REGISTER_RAW_SIZE);
32178cab
MS
685
686 /* See if we are trying to read bytes from out-of-date registers. If so,
687 update just those registers. */
688
5ebd2499 689 for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
32178cab 690 {
61a0eb5b
AC
691 int reg_start;
692 int reg_end;
693 int reg_len;
694 int start;
695 int end;
696 int byte;
32178cab 697
61a0eb5b
AC
698 reg_start = REGISTER_BYTE (regnum);
699 reg_len = REGISTER_RAW_SIZE (regnum);
700 reg_end = reg_start + reg_len;
32178cab 701
61a0eb5b 702 if (reg_end <= in_start || in_end <= reg_start)
5ebd2499 703 /* The range the user wants to read doesn't overlap with regnum. */
32178cab
MS
704 continue;
705
275f450c
AC
706 if (REGISTER_NAME (regnum) != NULL && *REGISTER_NAME (regnum) != '\0')
707 /* Force the cache to fetch the entire register. */
4caf0990 708 deprecated_read_register_gen (regnum, reg_buf);
275f450c
AC
709 else
710 /* Legacy note: even though this register is ``invalid'' we
711 still need to return something. It would appear that some
712 code relies on apparent gaps in the register array also
713 being returned. */
714 /* FIXME: cagney/2001-08-18: This is just silly. It defeats
715 the entire register read/write flow of control. Must
716 resist temptation to return 0xdeadbeef. */
524d7c18 717 memcpy (reg_buf, &deprecated_registers[reg_start], reg_len);
32178cab 718
61a0eb5b
AC
719 /* Legacy note: This function, for some reason, allows a NULL
720 input buffer. If the buffer is NULL, the registers are still
721 fetched, just the final transfer is skipped. */
722 if (in_buf == NULL)
723 continue;
724
725 /* start = max (reg_start, in_start) */
726 if (reg_start > in_start)
727 start = reg_start;
728 else
729 start = in_start;
730
731 /* end = min (reg_end, in_end) */
732 if (reg_end < in_end)
733 end = reg_end;
734 else
735 end = in_end;
736
737 /* Transfer just the bytes common to both IN_BUF and REG_BUF */
738 for (byte = start; byte < end; byte++)
165cd47f 739 {
61a0eb5b 740 in_buf[byte - in_start] = reg_buf[byte - reg_start];
165cd47f 741 }
32178cab 742 }
32178cab
MS
743}
744
5ebd2499
ND
745/* Read register REGNUM into memory at MYADDR, which must be large
746 enough for REGISTER_RAW_BYTES (REGNUM). Target byte-order. If the
32178cab
MS
747 register is known to be the size of a CORE_ADDR or smaller,
748 read_register can be used instead. */
749
61a0eb5b
AC
750static void
751legacy_read_register_gen (int regnum, char *myaddr)
32178cab 752{
61a0eb5b 753 gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
39f77062 754 if (! ptid_equal (registers_ptid, inferior_ptid))
32178cab
MS
755 {
756 registers_changed ();
39f77062 757 registers_ptid = inferior_ptid;
32178cab
MS
758 }
759
7302a204 760 if (!register_cached (regnum))
5c27f28a 761 target_fetch_registers (regnum);
7302a204 762
3fadccb3 763 memcpy (myaddr, register_buffer (current_regcache, regnum),
5ebd2499 764 REGISTER_RAW_SIZE (regnum));
32178cab
MS
765}
766
61a0eb5b 767void
1aaa5f99 768regcache_raw_read (struct regcache *regcache, int regnum, void *buf)
61a0eb5b 769{
3fadccb3
AC
770 gdb_assert (regcache != NULL && buf != NULL);
771 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
772 if (regcache->descr->legacy_p
2d28509a 773 && !regcache->readonly_p)
3fadccb3
AC
774 {
775 gdb_assert (regcache == current_regcache);
776 /* For moment, just use underlying legacy code. Ulgh!!! This
777 silently and very indirectly updates the regcache's regcache
8262ee23 778 via the global deprecated_register_valid[]. */
3fadccb3
AC
779 legacy_read_register_gen (regnum, buf);
780 return;
781 }
782 /* Make certain that the register cache is up-to-date with respect
783 to the current thread. This switching shouldn't be necessary
784 only there is still only one target side register cache. Sigh!
785 On the bright side, at least there is a regcache object. */
2d28509a 786 if (!regcache->readonly_p)
3fadccb3
AC
787 {
788 gdb_assert (regcache == current_regcache);
789 if (! ptid_equal (registers_ptid, inferior_ptid))
790 {
791 registers_changed ();
792 registers_ptid = inferior_ptid;
793 }
794 if (!register_cached (regnum))
5c27f28a 795 target_fetch_registers (regnum);
3fadccb3
AC
796 }
797 /* Copy the value directly into the register cache. */
51b1fe4e 798 memcpy (buf, register_buffer (regcache, regnum),
3fadccb3 799 regcache->descr->sizeof_register[regnum]);
61a0eb5b
AC
800}
801
28fc6740
AC
802void
803regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
804{
805 char *buf;
806 gdb_assert (regcache != NULL);
807 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
808 buf = alloca (regcache->descr->sizeof_register[regnum]);
809 regcache_raw_read (regcache, regnum, buf);
810 (*val) = extract_signed_integer (buf,
811 regcache->descr->sizeof_register[regnum]);
812}
813
814void
815regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
816 ULONGEST *val)
817{
818 char *buf;
819 gdb_assert (regcache != NULL);
820 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
821 buf = alloca (regcache->descr->sizeof_register[regnum]);
822 regcache_raw_read (regcache, regnum, buf);
823 (*val) = extract_unsigned_integer (buf,
824 regcache->descr->sizeof_register[regnum]);
825}
826
c00dcbe9
MK
827void
828regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val)
829{
830 void *buf;
831 gdb_assert (regcache != NULL);
832 gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
833 buf = alloca (regcache->descr->sizeof_register[regnum]);
834 store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val);
835 regcache_raw_write (regcache, regnum, buf);
836}
837
838void
839regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
840 ULONGEST val)
841{
842 void *buf;
843 gdb_assert (regcache != NULL);
844 gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
845 buf = alloca (regcache->descr->sizeof_register[regnum]);
846 store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val);
847 regcache_raw_write (regcache, regnum, buf);
848}
849
61a0eb5b 850void
4caf0990 851deprecated_read_register_gen (int regnum, char *buf)
61a0eb5b 852{
3fadccb3
AC
853 gdb_assert (current_regcache != NULL);
854 gdb_assert (current_regcache->descr->gdbarch == current_gdbarch);
855 if (current_regcache->descr->legacy_p)
61a0eb5b
AC
856 {
857 legacy_read_register_gen (regnum, buf);
858 return;
859 }
68365089
AC
860 regcache_cooked_read (current_regcache, regnum, buf);
861}
862
863void
29e1842b 864regcache_cooked_read (struct regcache *regcache, int regnum, void *buf)
68365089 865{
d138e37a 866 gdb_assert (regnum >= 0);
68365089
AC
867 gdb_assert (regnum < regcache->descr->nr_cooked_registers);
868 if (regnum < regcache->descr->nr_raw_registers)
869 regcache_raw_read (regcache, regnum, buf);
2d28509a
AC
870 else if (regcache->readonly_p
871 && regnum < regcache->descr->nr_cooked_registers
872 && regcache->register_valid_p[regnum])
873 /* Read-only register cache, perhaphs the cooked value was cached? */
874 memcpy (buf, register_buffer (regcache, regnum),
875 regcache->descr->sizeof_register[regnum]);
d138e37a 876 else
68365089
AC
877 gdbarch_pseudo_register_read (regcache->descr->gdbarch, regcache,
878 regnum, buf);
61a0eb5b
AC
879}
880
a378f419
AC
881void
882regcache_cooked_read_signed (struct regcache *regcache, int regnum,
883 LONGEST *val)
884{
885 char *buf;
886 gdb_assert (regcache != NULL);
887 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
888 buf = alloca (regcache->descr->sizeof_register[regnum]);
889 regcache_cooked_read (regcache, regnum, buf);
890 (*val) = extract_signed_integer (buf,
891 regcache->descr->sizeof_register[regnum]);
892}
893
894void
895regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
896 ULONGEST *val)
897{
898 char *buf;
899 gdb_assert (regcache != NULL);
900 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
901 buf = alloca (regcache->descr->sizeof_register[regnum]);
902 regcache_cooked_read (regcache, regnum, buf);
903 (*val) = extract_unsigned_integer (buf,
904 regcache->descr->sizeof_register[regnum]);
905}
906
5ebd2499
ND
907/* Write register REGNUM at MYADDR to the target. MYADDR points at
908 REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order. */
32178cab 909
61a0eb5b 910static void
1aaa5f99 911legacy_write_register_gen (int regnum, const void *myaddr)
32178cab
MS
912{
913 int size;
61a0eb5b 914 gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
32178cab
MS
915
916 /* On the sparc, writing %g0 is a no-op, so we don't even want to
917 change the registers array if something writes to this register. */
5ebd2499 918 if (CANNOT_STORE_REGISTER (regnum))
32178cab
MS
919 return;
920
39f77062 921 if (! ptid_equal (registers_ptid, inferior_ptid))
32178cab
MS
922 {
923 registers_changed ();
39f77062 924 registers_ptid = inferior_ptid;
32178cab
MS
925 }
926
5ebd2499 927 size = REGISTER_RAW_SIZE (regnum);
32178cab 928
7302a204 929 if (real_register (regnum))
1297a2f0
MS
930 {
931 /* If we have a valid copy of the register, and new value == old
932 value, then don't bother doing the actual store. */
933 if (register_cached (regnum)
3fadccb3
AC
934 && (memcmp (register_buffer (current_regcache, regnum), myaddr, size)
935 == 0))
1297a2f0
MS
936 return;
937 else
938 target_prepare_to_store ();
939 }
32178cab 940
3fadccb3 941 memcpy (register_buffer (current_regcache, regnum), myaddr, size);
32178cab 942
7302a204 943 set_register_cached (regnum, 1);
5c27f28a 944 target_store_registers (regnum);
32178cab
MS
945}
946
61a0eb5b 947void
1aaa5f99 948regcache_raw_write (struct regcache *regcache, int regnum, const void *buf)
61a0eb5b 949{
3fadccb3
AC
950 gdb_assert (regcache != NULL && buf != NULL);
951 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
2d28509a 952 gdb_assert (!regcache->readonly_p);
3fadccb3 953
2d28509a 954 if (regcache->descr->legacy_p)
3fadccb3
AC
955 {
956 /* For moment, just use underlying legacy code. Ulgh!!! This
957 silently and very indirectly updates the regcache's buffers
8262ee23 958 via the globals deprecated_register_valid[] and registers[]. */
3fadccb3
AC
959 gdb_assert (regcache == current_regcache);
960 legacy_write_register_gen (regnum, buf);
961 return;
962 }
963
964 /* On the sparc, writing %g0 is a no-op, so we don't even want to
965 change the registers array if something writes to this register. */
966 if (CANNOT_STORE_REGISTER (regnum))
967 return;
968
3fadccb3
AC
969 /* Make certain that the correct cache is selected. */
970 gdb_assert (regcache == current_regcache);
971 if (! ptid_equal (registers_ptid, inferior_ptid))
972 {
973 registers_changed ();
974 registers_ptid = inferior_ptid;
975 }
976
977 /* If we have a valid copy of the register, and new value == old
978 value, then don't bother doing the actual store. */
979 if (regcache_valid_p (regcache, regnum)
980 && (memcmp (register_buffer (regcache, regnum), buf,
981 regcache->descr->sizeof_register[regnum]) == 0))
982 return;
983
984 target_prepare_to_store ();
985 memcpy (register_buffer (regcache, regnum), buf,
986 regcache->descr->sizeof_register[regnum]);
51b1fe4e 987 regcache->register_valid_p[regnum] = 1;
5c27f28a 988 target_store_registers (regnum);
61a0eb5b
AC
989}
990
991void
4caf0990 992deprecated_write_register_gen (int regnum, char *buf)
61a0eb5b 993{
3fadccb3
AC
994 gdb_assert (current_regcache != NULL);
995 gdb_assert (current_regcache->descr->gdbarch == current_gdbarch);
996 if (current_regcache->descr->legacy_p)
61a0eb5b
AC
997 {
998 legacy_write_register_gen (regnum, buf);
999 return;
1000 }
68365089
AC
1001 regcache_cooked_write (current_regcache, regnum, buf);
1002}
1003
1004void
29e1842b 1005regcache_cooked_write (struct regcache *regcache, int regnum, const void *buf)
68365089 1006{
d138e37a 1007 gdb_assert (regnum >= 0);
68365089
AC
1008 gdb_assert (regnum < regcache->descr->nr_cooked_registers);
1009 if (regnum < regcache->descr->nr_raw_registers)
1010 regcache_raw_write (regcache, regnum, buf);
d138e37a 1011 else
68365089 1012 gdbarch_pseudo_register_write (regcache->descr->gdbarch, regcache,
d8124050 1013 regnum, buf);
61a0eb5b
AC
1014}
1015
32178cab
MS
1016/* Copy INLEN bytes of consecutive data from memory at MYADDR
1017 into registers starting with the MYREGSTART'th byte of register data. */
1018
1019void
73937e03 1020deprecated_write_register_bytes (int myregstart, char *myaddr, int inlen)
32178cab
MS
1021{
1022 int myregend = myregstart + inlen;
5ebd2499 1023 int regnum;
32178cab
MS
1024
1025 target_prepare_to_store ();
1026
1027 /* Scan through the registers updating any that are covered by the
1028 range myregstart<=>myregend using write_register_gen, which does
1029 nice things like handling threads, and avoiding updates when the
1030 new and old contents are the same. */
1031
5ebd2499 1032 for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
32178cab
MS
1033 {
1034 int regstart, regend;
1035
5ebd2499
ND
1036 regstart = REGISTER_BYTE (regnum);
1037 regend = regstart + REGISTER_RAW_SIZE (regnum);
32178cab
MS
1038
1039 /* Is this register completely outside the range the user is writing? */
1040 if (myregend <= regstart || regend <= myregstart)
1041 /* do nothing */ ;
1042
1043 /* Is this register completely within the range the user is writing? */
1044 else if (myregstart <= regstart && regend <= myregend)
4caf0990 1045 deprecated_write_register_gen (regnum, myaddr + (regstart - myregstart));
32178cab
MS
1046
1047 /* The register partially overlaps the range being written. */
1048 else
1049 {
e6cbd02a 1050 char *regbuf = (char*) alloca (MAX_REGISTER_RAW_SIZE);
32178cab
MS
1051 /* What's the overlap between this register's bytes and
1052 those the caller wants to write? */
1053 int overlapstart = max (regstart, myregstart);
1054 int overlapend = min (regend, myregend);
1055
1056 /* We may be doing a partial update of an invalid register.
1057 Update it from the target before scribbling on it. */
4caf0990 1058 deprecated_read_register_gen (regnum, regbuf);
32178cab 1059
524d7c18 1060 memcpy (&deprecated_registers[overlapstart],
32178cab
MS
1061 myaddr + (overlapstart - myregstart),
1062 overlapend - overlapstart);
1063
5c27f28a 1064 target_store_registers (regnum);
32178cab
MS
1065 }
1066 }
1067}
1068
06c0b04e
AC
1069/* Perform a partial register transfer using a read, modify, write
1070 operation. */
1071
1072typedef void (regcache_read_ftype) (struct regcache *regcache, int regnum,
1073 void *buf);
1074typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum,
1075 const void *buf);
1076
1077void
1078regcache_xfer_part (struct regcache *regcache, int regnum,
1079 int offset, int len, void *in, const void *out,
1080 regcache_read_ftype *read, regcache_write_ftype *write)
1081{
1082 struct regcache_descr *descr = regcache->descr;
1083 bfd_byte *reg = alloca (descr->max_register_size);
1084 gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]);
1085 gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]);
1086 /* Something to do? */
1087 if (offset + len == 0)
1088 return;
1089 /* Read (when needed) ... */
1090 if (in != NULL
1091 || offset > 0
1092 || offset + len < descr->sizeof_register[regnum])
1093 {
1094 gdb_assert (read != NULL);
1095 read (regcache, regnum, reg);
1096 }
1097 /* ... modify ... */
1098 if (in != NULL)
1099 memcpy (in, reg + offset, len);
1100 if (out != NULL)
1101 memcpy (reg + offset, out, len);
1102 /* ... write (when needed). */
1103 if (out != NULL)
1104 {
1105 gdb_assert (write != NULL);
1106 write (regcache, regnum, reg);
1107 }
1108}
1109
1110void
1111regcache_raw_read_part (struct regcache *regcache, int regnum,
1112 int offset, int len, void *buf)
1113{
1114 struct regcache_descr *descr = regcache->descr;
1115 gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
1116 regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
1117 regcache_raw_read, regcache_raw_write);
1118}
1119
1120void
1121regcache_raw_write_part (struct regcache *regcache, int regnum,
1122 int offset, int len, const void *buf)
1123{
1124 struct regcache_descr *descr = regcache->descr;
1125 gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
1126 regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
1127 regcache_raw_read, regcache_raw_write);
1128}
1129
1130void
1131regcache_cooked_read_part (struct regcache *regcache, int regnum,
1132 int offset, int len, void *buf)
1133{
1134 struct regcache_descr *descr = regcache->descr;
1135 gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
1136 regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
1137 regcache_cooked_read, regcache_cooked_write);
1138}
1139
1140void
1141regcache_cooked_write_part (struct regcache *regcache, int regnum,
1142 int offset, int len, const void *buf)
1143{
1144 struct regcache_descr *descr = regcache->descr;
1145 gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
1146 regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
1147 regcache_cooked_read, regcache_cooked_write);
1148}
32178cab 1149
d3b22ed5
AC
1150/* Hack to keep code that view the register buffer as raw bytes
1151 working. */
1152
1153int
1154register_offset_hack (struct gdbarch *gdbarch, int regnum)
1155{
1156 struct regcache_descr *descr = regcache_descr (gdbarch);
1157 gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
1158 return descr->register_offset[regnum];
1159}
1160
5ebd2499 1161/* Return the contents of register REGNUM as an unsigned integer. */
32178cab 1162
173155e8 1163ULONGEST
5ebd2499 1164read_register (int regnum)
32178cab 1165{
61a0eb5b 1166 char *buf = alloca (REGISTER_RAW_SIZE (regnum));
4caf0990 1167 deprecated_read_register_gen (regnum, buf);
61a0eb5b 1168 return (extract_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum)));
32178cab
MS
1169}
1170
173155e8 1171ULONGEST
39f77062 1172read_register_pid (int regnum, ptid_t ptid)
32178cab 1173{
39f77062 1174 ptid_t save_ptid;
32178cab
MS
1175 int save_pid;
1176 CORE_ADDR retval;
1177
39f77062 1178 if (ptid_equal (ptid, inferior_ptid))
5ebd2499 1179 return read_register (regnum);
32178cab 1180
39f77062 1181 save_ptid = inferior_ptid;
32178cab 1182
39f77062 1183 inferior_ptid = ptid;
32178cab 1184
5ebd2499 1185 retval = read_register (regnum);
32178cab 1186
39f77062 1187 inferior_ptid = save_ptid;
32178cab
MS
1188
1189 return retval;
1190}
1191
5ebd2499 1192/* Return the contents of register REGNUM as a signed integer. */
173155e8
AC
1193
1194LONGEST
5ebd2499 1195read_signed_register (int regnum)
173155e8 1196{
61a0eb5b 1197 void *buf = alloca (REGISTER_RAW_SIZE (regnum));
4caf0990 1198 deprecated_read_register_gen (regnum, buf);
61a0eb5b 1199 return (extract_signed_integer (buf, REGISTER_RAW_SIZE (regnum)));
173155e8
AC
1200}
1201
1202LONGEST
39f77062 1203read_signed_register_pid (int regnum, ptid_t ptid)
173155e8 1204{
39f77062 1205 ptid_t save_ptid;
173155e8
AC
1206 LONGEST retval;
1207
39f77062 1208 if (ptid_equal (ptid, inferior_ptid))
5ebd2499 1209 return read_signed_register (regnum);
173155e8 1210
39f77062 1211 save_ptid = inferior_ptid;
173155e8 1212
39f77062 1213 inferior_ptid = ptid;
173155e8 1214
5ebd2499 1215 retval = read_signed_register (regnum);
173155e8 1216
39f77062 1217 inferior_ptid = save_ptid;
173155e8
AC
1218
1219 return retval;
1220}
1221
5ebd2499 1222/* Store VALUE into the raw contents of register number REGNUM. */
32178cab
MS
1223
1224void
5ebd2499 1225write_register (int regnum, LONGEST val)
32178cab 1226{
61a0eb5b 1227 void *buf;
32178cab 1228 int size;
5ebd2499 1229 size = REGISTER_RAW_SIZE (regnum);
32178cab
MS
1230 buf = alloca (size);
1231 store_signed_integer (buf, size, (LONGEST) val);
4caf0990 1232 deprecated_write_register_gen (regnum, buf);
32178cab
MS
1233}
1234
1235void
39f77062 1236write_register_pid (int regnum, CORE_ADDR val, ptid_t ptid)
32178cab 1237{
39f77062 1238 ptid_t save_ptid;
32178cab 1239
39f77062 1240 if (ptid_equal (ptid, inferior_ptid))
32178cab 1241 {
5ebd2499 1242 write_register (regnum, val);
32178cab
MS
1243 return;
1244 }
1245
39f77062 1246 save_ptid = inferior_ptid;
32178cab 1247
39f77062 1248 inferior_ptid = ptid;
32178cab 1249
5ebd2499 1250 write_register (regnum, val);
32178cab 1251
39f77062 1252 inferior_ptid = save_ptid;
32178cab
MS
1253}
1254
1255/* SUPPLY_REGISTER()
1256
5ebd2499 1257 Record that register REGNUM contains VAL. This is used when the
32178cab
MS
1258 value is obtained from the inferior or core dump, so there is no
1259 need to store the value there.
1260
1261 If VAL is a NULL pointer, then it's probably an unsupported register.
5ebd2499 1262 We just set its value to all zeros. We might want to record this
32178cab
MS
1263 fact, and report it to the users of read_register and friends. */
1264
1265void
1aaa5f99 1266supply_register (int regnum, const void *val)
32178cab
MS
1267{
1268#if 1
39f77062 1269 if (! ptid_equal (registers_ptid, inferior_ptid))
32178cab
MS
1270 {
1271 registers_changed ();
39f77062 1272 registers_ptid = inferior_ptid;
32178cab
MS
1273 }
1274#endif
1275
7302a204 1276 set_register_cached (regnum, 1);
32178cab 1277 if (val)
3fadccb3 1278 memcpy (register_buffer (current_regcache, regnum), val,
5ebd2499 1279 REGISTER_RAW_SIZE (regnum));
32178cab 1280 else
3fadccb3 1281 memset (register_buffer (current_regcache, regnum), '\000',
5ebd2499 1282 REGISTER_RAW_SIZE (regnum));
32178cab
MS
1283
1284 /* On some architectures, e.g. HPPA, there are a few stray bits in
1285 some registers, that the rest of the code would like to ignore. */
1286
61a0eb5b
AC
1287 /* NOTE: cagney/2001-03-16: The macro CLEAN_UP_REGISTER_VALUE is
1288 going to be deprecated. Instead architectures will leave the raw
1289 register value as is and instead clean things up as they pass
d8124050 1290 through the method gdbarch_pseudo_register_read() clean up the
61a0eb5b
AC
1291 values. */
1292
4ee3352d 1293#ifdef DEPRECATED_CLEAN_UP_REGISTER_VALUE
0b434a00
AC
1294 DEPRECATED_CLEAN_UP_REGISTER_VALUE \
1295 (regnum, register_buffer (current_regcache, regnum));
32178cab
MS
1296#endif
1297}
1298
193cb69f
AC
1299void
1300regcache_collect (int regnum, void *buf)
1301{
3fadccb3
AC
1302 memcpy (buf, register_buffer (current_regcache, regnum),
1303 REGISTER_RAW_SIZE (regnum));
193cb69f
AC
1304}
1305
1306
8227c0ff
AC
1307/* read_pc, write_pc, read_sp, write_sp, read_fp, etc. Special
1308 handling for registers PC, SP, and FP. */
32178cab 1309
4e052eda
AC
1310/* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(),
1311 read_pc_pid(), read_pc(), generic_target_write_pc(),
1312 write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(),
8227c0ff
AC
1313 generic_target_write_sp(), write_sp(), generic_target_read_fp() and
1314 read_fp(), will eventually be moved out of the reg-cache into
1315 either frame.[hc] or to the multi-arch framework. The are not part
1316 of the raw register cache. */
4e052eda 1317
32178cab
MS
1318/* This routine is getting awfully cluttered with #if's. It's probably
1319 time to turn this into READ_PC and define it in the tm.h file.
1320 Ditto for write_pc.
1321
1322 1999-06-08: The following were re-written so that it assumes the
8e1a459b 1323 existence of a TARGET_READ_PC et.al. macro. A default generic
32178cab
MS
1324 version of that macro is made available where needed.
1325
1326 Since the ``TARGET_READ_PC'' et.al. macro is going to be controlled
1327 by the multi-arch framework, it will eventually be possible to
1328 eliminate the intermediate read_pc_pid(). The client would call
1329 TARGET_READ_PC directly. (cagney). */
1330
32178cab 1331CORE_ADDR
39f77062 1332generic_target_read_pc (ptid_t ptid)
32178cab
MS
1333{
1334#ifdef PC_REGNUM
1335 if (PC_REGNUM >= 0)
1336 {
39f77062 1337 CORE_ADDR pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, ptid));
32178cab
MS
1338 return pc_val;
1339 }
1340#endif
8e65ff28
AC
1341 internal_error (__FILE__, __LINE__,
1342 "generic_target_read_pc");
32178cab
MS
1343 return 0;
1344}
1345
1346CORE_ADDR
39f77062 1347read_pc_pid (ptid_t ptid)
32178cab 1348{
39f77062 1349 ptid_t saved_inferior_ptid;
32178cab
MS
1350 CORE_ADDR pc_val;
1351
39f77062
KB
1352 /* In case ptid != inferior_ptid. */
1353 saved_inferior_ptid = inferior_ptid;
1354 inferior_ptid = ptid;
32178cab 1355
39f77062 1356 pc_val = TARGET_READ_PC (ptid);
32178cab 1357
39f77062 1358 inferior_ptid = saved_inferior_ptid;
32178cab
MS
1359 return pc_val;
1360}
1361
1362CORE_ADDR
1363read_pc (void)
1364{
39f77062 1365 return read_pc_pid (inferior_ptid);
32178cab
MS
1366}
1367
32178cab 1368void
39f77062 1369generic_target_write_pc (CORE_ADDR pc, ptid_t ptid)
32178cab
MS
1370{
1371#ifdef PC_REGNUM
1372 if (PC_REGNUM >= 0)
39f77062 1373 write_register_pid (PC_REGNUM, pc, ptid);
32178cab 1374 if (NPC_REGNUM >= 0)
39f77062 1375 write_register_pid (NPC_REGNUM, pc + 4, ptid);
32178cab 1376#else
8e65ff28
AC
1377 internal_error (__FILE__, __LINE__,
1378 "generic_target_write_pc");
32178cab
MS
1379#endif
1380}
1381
1382void
39f77062 1383write_pc_pid (CORE_ADDR pc, ptid_t ptid)
32178cab 1384{
39f77062 1385 ptid_t saved_inferior_ptid;
32178cab 1386
39f77062
KB
1387 /* In case ptid != inferior_ptid. */
1388 saved_inferior_ptid = inferior_ptid;
1389 inferior_ptid = ptid;
32178cab 1390
39f77062 1391 TARGET_WRITE_PC (pc, ptid);
32178cab 1392
39f77062 1393 inferior_ptid = saved_inferior_ptid;
32178cab
MS
1394}
1395
1396void
1397write_pc (CORE_ADDR pc)
1398{
39f77062 1399 write_pc_pid (pc, inferior_ptid);
32178cab
MS
1400}
1401
1402/* Cope with strage ways of getting to the stack and frame pointers */
1403
32178cab
MS
1404CORE_ADDR
1405generic_target_read_sp (void)
1406{
1407#ifdef SP_REGNUM
1408 if (SP_REGNUM >= 0)
1409 return read_register (SP_REGNUM);
1410#endif
8e65ff28
AC
1411 internal_error (__FILE__, __LINE__,
1412 "generic_target_read_sp");
32178cab
MS
1413}
1414
1415CORE_ADDR
1416read_sp (void)
1417{
1418 return TARGET_READ_SP ();
1419}
1420
32178cab
MS
1421void
1422generic_target_write_sp (CORE_ADDR val)
1423{
1424#ifdef SP_REGNUM
1425 if (SP_REGNUM >= 0)
1426 {
1427 write_register (SP_REGNUM, val);
1428 return;
1429 }
1430#endif
8e65ff28
AC
1431 internal_error (__FILE__, __LINE__,
1432 "generic_target_write_sp");
32178cab
MS
1433}
1434
1435void
1436write_sp (CORE_ADDR val)
1437{
1438 TARGET_WRITE_SP (val);
1439}
1440
32178cab
MS
1441CORE_ADDR
1442generic_target_read_fp (void)
1443{
1444#ifdef FP_REGNUM
1445 if (FP_REGNUM >= 0)
1446 return read_register (FP_REGNUM);
1447#endif
8e65ff28
AC
1448 internal_error (__FILE__, __LINE__,
1449 "generic_target_read_fp");
32178cab
MS
1450}
1451
1452CORE_ADDR
1453read_fp (void)
1454{
1455 return TARGET_READ_FP ();
1456}
1457
705152c5
MS
1458/* ARGSUSED */
1459static void
1460reg_flush_command (char *command, int from_tty)
1461{
1462 /* Force-flush the register cache. */
1463 registers_changed ();
1464 if (from_tty)
1465 printf_filtered ("Register cache flushed.\n");
1466}
1467
32178cab
MS
1468static void
1469build_regcache (void)
3fadccb3
AC
1470{
1471 current_regcache = regcache_xmalloc (current_gdbarch);
2d28509a 1472 current_regcache->readonly_p = 0;
524d7c18 1473 deprecated_registers = deprecated_grub_regcache_for_registers (current_regcache);
8262ee23 1474 deprecated_register_valid = deprecated_grub_regcache_for_register_valid (current_regcache);
3fadccb3
AC
1475}
1476
af030b9a
AC
1477static void
1478dump_endian_bytes (struct ui_file *file, enum bfd_endian endian,
1479 const unsigned char *buf, long len)
1480{
1481 int i;
1482 switch (endian)
1483 {
1484 case BFD_ENDIAN_BIG:
1485 for (i = 0; i < len; i++)
1486 fprintf_unfiltered (file, "%02x", buf[i]);
1487 break;
1488 case BFD_ENDIAN_LITTLE:
1489 for (i = len - 1; i >= 0; i--)
1490 fprintf_unfiltered (file, "%02x", buf[i]);
1491 break;
1492 default:
1493 internal_error (__FILE__, __LINE__, "Bad switch");
1494 }
1495}
1496
1497enum regcache_dump_what
1498{
b59ff9d5 1499 regcache_dump_none, regcache_dump_raw, regcache_dump_cooked, regcache_dump_groups
af030b9a
AC
1500};
1501
1502static void
1503regcache_dump (struct regcache *regcache, struct ui_file *file,
1504 enum regcache_dump_what what_to_dump)
1505{
1506 struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
b59ff9d5
AC
1507 struct gdbarch *gdbarch = regcache->descr->gdbarch;
1508 struct reggroup *const *groups = reggroups (gdbarch);
af030b9a
AC
1509 int regnum;
1510 int footnote_nr = 0;
1511 int footnote_register_size = 0;
1512 int footnote_register_offset = 0;
1513 int footnote_register_type_name_null = 0;
1514 long register_offset = 0;
1515 unsigned char *buf = alloca (regcache->descr->max_register_size);
1516
1517#if 0
1518 fprintf_unfiltered (file, "legacy_p %d\n", regcache->descr->legacy_p);
1519 fprintf_unfiltered (file, "nr_raw_registers %d\n",
1520 regcache->descr->nr_raw_registers);
1521 fprintf_unfiltered (file, "nr_cooked_registers %d\n",
1522 regcache->descr->nr_cooked_registers);
1523 fprintf_unfiltered (file, "sizeof_raw_registers %ld\n",
1524 regcache->descr->sizeof_raw_registers);
1525 fprintf_unfiltered (file, "sizeof_raw_register_valid_p %ld\n",
1526 regcache->descr->sizeof_raw_register_valid_p);
1527 fprintf_unfiltered (file, "max_register_size %ld\n",
1528 regcache->descr->max_register_size);
1529 fprintf_unfiltered (file, "NUM_REGS %d\n", NUM_REGS);
1530 fprintf_unfiltered (file, "NUM_PSEUDO_REGS %d\n", NUM_PSEUDO_REGS);
1531#endif
1532
1533 gdb_assert (regcache->descr->nr_cooked_registers
1534 == (NUM_REGS + NUM_PSEUDO_REGS));
1535
1536 for (regnum = -1; regnum < regcache->descr->nr_cooked_registers; regnum++)
1537 {
1538 /* Name. */
1539 if (regnum < 0)
1540 fprintf_unfiltered (file, " %-10s", "Name");
1541 else
1542 {
1543 const char *p = REGISTER_NAME (regnum);
1544 if (p == NULL)
1545 p = "";
1546 else if (p[0] == '\0')
1547 p = "''";
1548 fprintf_unfiltered (file, " %-10s", p);
1549 }
1550
1551 /* Number. */
1552 if (regnum < 0)
1553 fprintf_unfiltered (file, " %4s", "Nr");
1554 else
1555 fprintf_unfiltered (file, " %4d", regnum);
1556
1557 /* Relative number. */
1558 if (regnum < 0)
1559 fprintf_unfiltered (file, " %4s", "Rel");
1560 else if (regnum < NUM_REGS)
1561 fprintf_unfiltered (file, " %4d", regnum);
1562 else
1563 fprintf_unfiltered (file, " %4d", (regnum - NUM_REGS));
1564
1565 /* Offset. */
1566 if (regnum < 0)
1567 fprintf_unfiltered (file, " %6s ", "Offset");
1568 else
1569 {
1570 fprintf_unfiltered (file, " %6ld",
1571 regcache->descr->register_offset[regnum]);
a7e3c2ad 1572 if (register_offset != regcache->descr->register_offset[regnum]
d3b22ed5
AC
1573 || register_offset != REGISTER_BYTE (regnum)
1574 || (regnum > 0
1575 && (regcache->descr->register_offset[regnum]
1576 != (regcache->descr->register_offset[regnum - 1]
1577 + regcache->descr->sizeof_register[regnum - 1])))
1578 )
af030b9a
AC
1579 {
1580 if (!footnote_register_offset)
1581 footnote_register_offset = ++footnote_nr;
1582 fprintf_unfiltered (file, "*%d", footnote_register_offset);
1583 }
1584 else
1585 fprintf_unfiltered (file, " ");
1586 register_offset = (regcache->descr->register_offset[regnum]
1587 + regcache->descr->sizeof_register[regnum]);
1588 }
1589
1590 /* Size. */
1591 if (regnum < 0)
1592 fprintf_unfiltered (file, " %5s ", "Size");
1593 else
1594 {
1595 fprintf_unfiltered (file, " %5ld",
1596 regcache->descr->sizeof_register[regnum]);
1597 if ((regcache->descr->sizeof_register[regnum]
1598 != REGISTER_RAW_SIZE (regnum))
1599 || (regcache->descr->sizeof_register[regnum]
1600 != REGISTER_VIRTUAL_SIZE (regnum))
1601 || (regcache->descr->sizeof_register[regnum]
bb425013
AC
1602 != TYPE_LENGTH (register_type (regcache->descr->gdbarch,
1603 regnum)))
af030b9a
AC
1604 )
1605 {
1606 if (!footnote_register_size)
1607 footnote_register_size = ++footnote_nr;
1608 fprintf_unfiltered (file, "*%d", footnote_register_size);
1609 }
1610 else
1611 fprintf_unfiltered (file, " ");
1612 }
1613
1614 /* Type. */
b59ff9d5
AC
1615 {
1616 const char *t;
1617 if (regnum < 0)
1618 t = "Type";
1619 else
1620 {
1621 static const char blt[] = "builtin_type";
1622 t = TYPE_NAME (register_type (regcache->descr->gdbarch, regnum));
1623 if (t == NULL)
1624 {
1625 char *n;
1626 if (!footnote_register_type_name_null)
1627 footnote_register_type_name_null = ++footnote_nr;
1628 xasprintf (&n, "*%d", footnote_register_type_name_null);
1629 make_cleanup (xfree, n);
1630 t = n;
1631 }
1632 /* Chop a leading builtin_type. */
1633 if (strncmp (t, blt, strlen (blt)) == 0)
1634 t += strlen (blt);
1635 }
1636 fprintf_unfiltered (file, " %-15s", t);
1637 }
1638
1639 /* Leading space always present. */
1640 fprintf_unfiltered (file, " ");
af030b9a
AC
1641
1642 /* Value, raw. */
1643 if (what_to_dump == regcache_dump_raw)
1644 {
1645 if (regnum < 0)
1646 fprintf_unfiltered (file, "Raw value");
1647 else if (regnum >= regcache->descr->nr_raw_registers)
1648 fprintf_unfiltered (file, "<cooked>");
1649 else if (!regcache_valid_p (regcache, regnum))
1650 fprintf_unfiltered (file, "<invalid>");
1651 else
1652 {
1653 regcache_raw_read (regcache, regnum, buf);
1654 fprintf_unfiltered (file, "0x");
1655 dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
1656 REGISTER_RAW_SIZE (regnum));
1657 }
1658 }
1659
1660 /* Value, cooked. */
1661 if (what_to_dump == regcache_dump_cooked)
1662 {
1663 if (regnum < 0)
1664 fprintf_unfiltered (file, "Cooked value");
1665 else
1666 {
1667 regcache_cooked_read (regcache, regnum, buf);
1668 fprintf_unfiltered (file, "0x");
1669 dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
1670 REGISTER_VIRTUAL_SIZE (regnum));
1671 }
1672 }
1673
b59ff9d5
AC
1674 /* Group members. */
1675 if (what_to_dump == regcache_dump_groups)
1676 {
1677 if (regnum < 0)
1678 fprintf_unfiltered (file, "Groups");
1679 else
1680 {
1681 int i;
1682 const char *sep = "";
1683 for (i = 0; groups[i] != NULL; i++)
1684 {
1685 if (gdbarch_register_reggroup_p (gdbarch, regnum, groups[i]))
1686 {
1687 fprintf_unfiltered (file, "%s%s", sep, reggroup_name (groups[i]));
1688 sep = ",";
1689 }
1690 }
1691 }
1692 }
1693
af030b9a
AC
1694 fprintf_unfiltered (file, "\n");
1695 }
1696
1697 if (footnote_register_size)
1698 fprintf_unfiltered (file, "*%d: Inconsistent register sizes.\n",
1699 footnote_register_size);
1700 if (footnote_register_offset)
1701 fprintf_unfiltered (file, "*%d: Inconsistent register offsets.\n",
1702 footnote_register_offset);
1703 if (footnote_register_type_name_null)
1704 fprintf_unfiltered (file,
1705 "*%d: Register type's name NULL.\n",
1706 footnote_register_type_name_null);
1707 do_cleanups (cleanups);
1708}
1709
1710static void
1711regcache_print (char *args, enum regcache_dump_what what_to_dump)
1712{
1713 if (args == NULL)
1714 regcache_dump (current_regcache, gdb_stdout, what_to_dump);
1715 else
1716 {
1717 struct ui_file *file = gdb_fopen (args, "w");
1718 if (file == NULL)
1719 perror_with_name ("maintenance print architecture");
1720 regcache_dump (current_regcache, file, what_to_dump);
1721 ui_file_delete (file);
1722 }
1723}
1724
1725static void
1726maintenance_print_registers (char *args, int from_tty)
1727{
1728 regcache_print (args, regcache_dump_none);
1729}
1730
1731static void
1732maintenance_print_raw_registers (char *args, int from_tty)
1733{
1734 regcache_print (args, regcache_dump_raw);
1735}
1736
1737static void
1738maintenance_print_cooked_registers (char *args, int from_tty)
1739{
1740 regcache_print (args, regcache_dump_cooked);
1741}
1742
b59ff9d5
AC
1743static void
1744maintenance_print_register_groups (char *args, int from_tty)
1745{
1746 regcache_print (args, regcache_dump_groups);
1747}
1748
32178cab
MS
1749void
1750_initialize_regcache (void)
1751{
3fadccb3
AC
1752 regcache_descr_handle = register_gdbarch_data (init_regcache_descr,
1753 xfree_regcache_descr);
1754 REGISTER_GDBARCH_SWAP (current_regcache);
524d7c18 1755 register_gdbarch_swap (&deprecated_registers, sizeof (deprecated_registers), NULL);
8262ee23 1756 register_gdbarch_swap (&deprecated_register_valid, sizeof (deprecated_register_valid), NULL);
32178cab 1757 register_gdbarch_swap (NULL, 0, build_regcache);
705152c5
MS
1758
1759 add_com ("flushregs", class_maintenance, reg_flush_command,
1760 "Force gdb to flush its register cache (maintainer command)");
39f77062
KB
1761
1762 /* Initialize the thread/process associated with the current set of
1763 registers. For now, -1 is special, and means `no current process'. */
1764 registers_ptid = pid_to_ptid (-1);
af030b9a
AC
1765
1766 add_cmd ("registers", class_maintenance,
1767 maintenance_print_registers,
1768 "Print the internal register configuration.\
1769Takes an optional file parameter.",
1770 &maintenanceprintlist);
1771 add_cmd ("raw-registers", class_maintenance,
1772 maintenance_print_raw_registers,
1773 "Print the internal register configuration including raw values.\
1774Takes an optional file parameter.",
1775 &maintenanceprintlist);
1776 add_cmd ("cooked-registers", class_maintenance,
1777 maintenance_print_cooked_registers,
1778 "Print the internal register configuration including cooked values.\
b59ff9d5
AC
1779Takes an optional file parameter.",
1780 &maintenanceprintlist);
1781 add_cmd ("register-groups", class_maintenance,
1782 maintenance_print_register_groups,
1783 "Print the internal register configuration including each register's group.\
af030b9a
AC
1784Takes an optional file parameter.",
1785 &maintenanceprintlist);
1786
32178cab 1787}
This page took 0.379511 seconds and 4 git commands to generate.