* gdb.ada/atomic_enum: New test program.
[deliverable/binutils-gdb.git] / gdb / regcache.c
CommitLineData
32178cab 1/* Cache and manage the values of registers for GDB, the GNU debugger.
3fadccb3 2
6aba47ca 3 Copyright (C) 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000, 2001,
9b254dd1 4 2002, 2004, 2007, 2008 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
a9762ec7 10 the Free Software Foundation; either version 3 of the License, or
32178cab
MS
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
a9762ec7 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
32178cab
MS
20
21#include "defs.h"
32178cab
MS
22#include "inferior.h"
23#include "target.h"
24#include "gdbarch.h"
705152c5 25#include "gdbcmd.h"
4e052eda 26#include "regcache.h"
b59ff9d5 27#include "reggroups.h"
61a0eb5b 28#include "gdb_assert.h"
b66d6d2e 29#include "gdb_string.h"
af030b9a 30#include "gdbcmd.h" /* For maintenanceprintlist. */
f4c5303c 31#include "observer.h"
32178cab
MS
32
33/*
34 * DATA STRUCTURE
35 *
36 * Here is the actual register cache.
37 */
38
3fadccb3
AC
39/* Per-architecture object describing the layout of a register cache.
40 Computed once when the architecture is created */
41
42struct gdbarch_data *regcache_descr_handle;
43
44struct regcache_descr
45{
46 /* The architecture this descriptor belongs to. */
47 struct gdbarch *gdbarch;
48
bb1db049
AC
49 /* The raw register cache. Each raw (or hard) register is supplied
50 by the target interface. The raw cache should not contain
51 redundant information - if the PC is constructed from two
d2f0b918 52 registers then those registers and not the PC lives in the raw
bb1db049 53 cache. */
3fadccb3
AC
54 int nr_raw_registers;
55 long sizeof_raw_registers;
56 long sizeof_raw_register_valid_p;
57
d138e37a
AC
58 /* The cooked register space. Each cooked register in the range
59 [0..NR_RAW_REGISTERS) is direct-mapped onto the corresponding raw
60 register. The remaining [NR_RAW_REGISTERS
02f60eae 61 .. NR_COOKED_REGISTERS) (a.k.a. pseudo registers) are mapped onto
d138e37a 62 both raw registers and memory by the architecture methods
02f60eae 63 gdbarch_pseudo_register_read and gdbarch_pseudo_register_write. */
d138e37a 64 int nr_cooked_registers;
067df2e5
AC
65 long sizeof_cooked_registers;
66 long sizeof_cooked_register_valid_p;
d138e37a
AC
67
68 /* Offset and size (in 8 bit bytes), of reach register in the
69 register cache. All registers (including those in the range
70 [NR_RAW_REGISTERS .. NR_COOKED_REGISTERS) are given an offset.
71 Assigning all registers an offset makes it possible to keep
72 legacy code, such as that found in read_register_bytes() and
73 write_register_bytes() working. */
3fadccb3 74 long *register_offset;
3fadccb3 75 long *sizeof_register;
3fadccb3 76
bb425013
AC
77 /* Cached table containing the type of each register. */
78 struct type **register_type;
3fadccb3
AC
79};
80
3fadccb3
AC
81static void *
82init_regcache_descr (struct gdbarch *gdbarch)
83{
84 int i;
85 struct regcache_descr *descr;
86 gdb_assert (gdbarch != NULL);
87
bb425013 88 /* Create an initial, zero filled, table. */
116f06ea 89 descr = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct regcache_descr);
3fadccb3 90 descr->gdbarch = gdbarch;
3fadccb3 91
d138e37a
AC
92 /* Total size of the register space. The raw registers are mapped
93 directly onto the raw register cache while the pseudo's are
3fadccb3 94 either mapped onto raw-registers or memory. */
214e098a
UW
95 descr->nr_cooked_registers = gdbarch_num_regs (gdbarch)
96 + gdbarch_num_pseudo_regs (gdbarch);
97 descr->sizeof_cooked_register_valid_p = gdbarch_num_regs (gdbarch)
f57d151a 98 + gdbarch_num_pseudo_regs
214e098a 99 (gdbarch);
3fadccb3 100
bb425013 101 /* Fill in a table of register types. */
116f06ea
AC
102 descr->register_type
103 = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, struct type *);
bb425013 104 for (i = 0; i < descr->nr_cooked_registers; i++)
336a3131 105 descr->register_type[i] = gdbarch_register_type (gdbarch, i);
bb425013 106
bb1db049
AC
107 /* Construct a strictly RAW register cache. Don't allow pseudo's
108 into the register cache. */
214e098a 109 descr->nr_raw_registers = gdbarch_num_regs (gdbarch);
bb1db049
AC
110
111 /* FIXME: cagney/2002-08-13: Overallocate the register_valid_p
112 array. This pretects GDB from erant code that accesses elements
f57d151a
UW
113 of the global register_valid_p[] array in the range
114 [gdbarch_num_regs .. gdbarch_num_regs + gdbarch_num_pseudo_regs). */
bb1db049
AC
115 descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p;
116
067df2e5 117 /* Lay out the register cache.
3fadccb3 118
bb425013
AC
119 NOTE: cagney/2002-05-22: Only register_type() is used when
120 constructing the register cache. It is assumed that the
121 register's raw size, virtual size and type length are all the
122 same. */
3fadccb3
AC
123
124 {
125 long offset = 0;
116f06ea
AC
126 descr->sizeof_register
127 = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
128 descr->register_offset
129 = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
d138e37a 130 for (i = 0; i < descr->nr_cooked_registers; i++)
3fadccb3 131 {
bb425013 132 descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
3fadccb3
AC
133 descr->register_offset[i] = offset;
134 offset += descr->sizeof_register[i];
123a958e 135 gdb_assert (MAX_REGISTER_SIZE >= descr->sizeof_register[i]);
3fadccb3
AC
136 }
137 /* Set the real size of the register cache buffer. */
067df2e5 138 descr->sizeof_cooked_registers = offset;
3fadccb3
AC
139 }
140
067df2e5 141 /* FIXME: cagney/2002-05-22: Should only need to allocate space for
ce2826aa 142 the raw registers. Unfortunately some code still accesses the
067df2e5
AC
143 register array directly using the global registers[]. Until that
144 code has been purged, play safe and over allocating the register
145 buffer. Ulgh! */
146 descr->sizeof_raw_registers = descr->sizeof_cooked_registers;
147
3fadccb3
AC
148 return descr;
149}
150
151static struct regcache_descr *
152regcache_descr (struct gdbarch *gdbarch)
153{
154 return gdbarch_data (gdbarch, regcache_descr_handle);
155}
156
bb425013
AC
157/* Utility functions returning useful register attributes stored in
158 the regcache descr. */
159
160struct type *
161register_type (struct gdbarch *gdbarch, int regnum)
162{
163 struct regcache_descr *descr = regcache_descr (gdbarch);
164 gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
165 return descr->register_type[regnum];
166}
167
0ed04cce
AC
168/* Utility functions returning useful register attributes stored in
169 the regcache descr. */
170
08a617da
AC
171int
172register_size (struct gdbarch *gdbarch, int regnum)
173{
174 struct regcache_descr *descr = regcache_descr (gdbarch);
175 int size;
f57d151a 176 gdb_assert (regnum >= 0
214e098a
UW
177 && regnum < (gdbarch_num_regs (gdbarch)
178 + gdbarch_num_pseudo_regs (gdbarch)));
08a617da 179 size = descr->sizeof_register[regnum];
08a617da
AC
180 return size;
181}
182
3fadccb3
AC
183/* The register cache for storing raw register values. */
184
185struct regcache
186{
187 struct regcache_descr *descr;
51b1fe4e 188 /* The register buffers. A read-only register cache can hold the
f57d151a
UW
189 full [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs) while a read/write
190 register cache can only hold [0 .. gdbarch_num_regs). */
2d522557 191 gdb_byte *registers;
b05e64e5
FR
192 /* Register cache status:
193 register_valid_p[REG] == 0 if REG value is not in the cache
194 > 0 if REG value is in the cache
195 < 0 if REG value is permanently unavailable */
196 signed char *register_valid_p;
2d28509a
AC
197 /* Is this a read-only cache? A read-only cache is used for saving
198 the target's register state (e.g, across an inferior function
199 call or just before forcing a function return). A read-only
200 cache can only be updated via the methods regcache_dup() and
201 regcache_cpy(). The actual contents are determined by the
202 reggroup_save and reggroup_restore methods. */
203 int readonly_p;
594f7785
UW
204 /* If this is a read-write cache, which thread's registers is
205 it connected to? */
206 ptid_t ptid;
3fadccb3
AC
207};
208
209struct regcache *
210regcache_xmalloc (struct gdbarch *gdbarch)
211{
212 struct regcache_descr *descr;
213 struct regcache *regcache;
214 gdb_assert (gdbarch != NULL);
215 descr = regcache_descr (gdbarch);
216 regcache = XMALLOC (struct regcache);
217 regcache->descr = descr;
51b1fe4e 218 regcache->registers
2d522557 219 = XCALLOC (descr->sizeof_raw_registers, gdb_byte);
51b1fe4e 220 regcache->register_valid_p
2d522557 221 = XCALLOC (descr->sizeof_raw_register_valid_p, gdb_byte);
2d28509a 222 regcache->readonly_p = 1;
594f7785 223 regcache->ptid = minus_one_ptid;
3fadccb3
AC
224 return regcache;
225}
226
227void
228regcache_xfree (struct regcache *regcache)
229{
230 if (regcache == NULL)
231 return;
51b1fe4e
AC
232 xfree (regcache->registers);
233 xfree (regcache->register_valid_p);
3fadccb3
AC
234 xfree (regcache);
235}
236
b9362cc7 237static void
36160dc4
AC
238do_regcache_xfree (void *data)
239{
240 regcache_xfree (data);
241}
242
243struct cleanup *
244make_cleanup_regcache_xfree (struct regcache *regcache)
245{
246 return make_cleanup (do_regcache_xfree, regcache);
247}
248
41d35cb0
MK
249/* Return REGCACHE's architecture. */
250
251struct gdbarch *
252get_regcache_arch (const struct regcache *regcache)
253{
254 return regcache->descr->gdbarch;
255}
256
51b1fe4e
AC
257/* Return a pointer to register REGNUM's buffer cache. */
258
2d522557 259static gdb_byte *
9a661b68 260register_buffer (const struct regcache *regcache, int regnum)
51b1fe4e
AC
261{
262 return regcache->registers + regcache->descr->register_offset[regnum];
263}
264
2d28509a 265void
5602984a
AC
266regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read,
267 void *src)
2d28509a
AC
268{
269 struct gdbarch *gdbarch = dst->descr->gdbarch;
2d522557 270 gdb_byte buf[MAX_REGISTER_SIZE];
2d28509a 271 int regnum;
2d28509a 272 /* The DST should be `read-only', if it wasn't then the save would
5602984a 273 end up trying to write the register values back out to the
2d28509a 274 target. */
2d28509a
AC
275 gdb_assert (dst->readonly_p);
276 /* Clear the dest. */
277 memset (dst->registers, 0, dst->descr->sizeof_cooked_registers);
278 memset (dst->register_valid_p, 0, dst->descr->sizeof_cooked_register_valid_p);
279 /* Copy over any registers (identified by their membership in the
f57d151a
UW
280 save_reggroup) and mark them as valid. The full [0 .. gdbarch_num_regs +
281 gdbarch_num_pseudo_regs) range is checked since some architectures need
5602984a 282 to save/restore `cooked' registers that live in memory. */
2d28509a
AC
283 for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++)
284 {
285 if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup))
286 {
5602984a
AC
287 int valid = cooked_read (src, regnum, buf);
288 if (valid)
289 {
290 memcpy (register_buffer (dst, regnum), buf,
291 register_size (gdbarch, regnum));
292 dst->register_valid_p[regnum] = 1;
293 }
2d28509a
AC
294 }
295 }
296}
297
298void
5602984a
AC
299regcache_restore (struct regcache *dst,
300 regcache_cooked_read_ftype *cooked_read,
2d522557 301 void *cooked_read_context)
2d28509a
AC
302{
303 struct gdbarch *gdbarch = dst->descr->gdbarch;
2d522557 304 gdb_byte buf[MAX_REGISTER_SIZE];
2d28509a 305 int regnum;
5602984a
AC
306 /* The dst had better not be read-only. If it is, the `restore'
307 doesn't make much sense. */
2d28509a 308 gdb_assert (!dst->readonly_p);
2d28509a 309 /* Copy over any registers, being careful to only restore those that
f57d151a
UW
310 were both saved and need to be restored. The full [0 .. gdbarch_num_regs
311 + gdbarch_num_pseudo_regs) range is checked since some architectures need
5602984a
AC
312 to save/restore `cooked' registers that live in memory. */
313 for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++)
2d28509a 314 {
5602984a 315 if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
2d28509a 316 {
2d522557 317 int valid = cooked_read (cooked_read_context, regnum, buf);
5602984a
AC
318 if (valid)
319 regcache_cooked_write (dst, regnum, buf);
2d28509a
AC
320 }
321 }
322}
323
5602984a 324static int
2d522557 325do_cooked_read (void *src, int regnum, gdb_byte *buf)
5602984a
AC
326{
327 struct regcache *regcache = src;
6f4e5a41 328 if (!regcache->register_valid_p[regnum] && regcache->readonly_p)
5602984a
AC
329 /* Don't even think about fetching a register from a read-only
330 cache when the register isn't yet valid. There isn't a target
331 from which the register value can be fetched. */
332 return 0;
333 regcache_cooked_read (regcache, regnum, buf);
334 return 1;
335}
336
337
3fadccb3
AC
338void
339regcache_cpy (struct regcache *dst, struct regcache *src)
340{
341 int i;
2d522557 342 gdb_byte *buf;
3fadccb3
AC
343 gdb_assert (src != NULL && dst != NULL);
344 gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
345 gdb_assert (src != dst);
2d28509a
AC
346 gdb_assert (src->readonly_p || dst->readonly_p);
347 if (!src->readonly_p)
5602984a 348 regcache_save (dst, do_cooked_read, src);
2d28509a 349 else if (!dst->readonly_p)
5602984a 350 regcache_restore (dst, do_cooked_read, src);
2d28509a
AC
351 else
352 regcache_cpy_no_passthrough (dst, src);
3fadccb3
AC
353}
354
355void
356regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src)
357{
358 int i;
359 gdb_assert (src != NULL && dst != NULL);
360 gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
361 /* NOTE: cagney/2002-05-17: Don't let the caller do a no-passthrough
594f7785 362 move of data into the current regcache. Doing this would be
9564ee9f 363 silly - it would mean that valid_p would be completely invalid. */
594f7785 364 gdb_assert (dst->readonly_p);
51b1fe4e
AC
365 memcpy (dst->registers, src->registers, dst->descr->sizeof_raw_registers);
366 memcpy (dst->register_valid_p, src->register_valid_p,
3fadccb3
AC
367 dst->descr->sizeof_raw_register_valid_p);
368}
369
370struct regcache *
371regcache_dup (struct regcache *src)
372{
373 struct regcache *newbuf;
3fadccb3
AC
374 newbuf = regcache_xmalloc (src->descr->gdbarch);
375 regcache_cpy (newbuf, src);
376 return newbuf;
377}
378
379struct regcache *
380regcache_dup_no_passthrough (struct regcache *src)
381{
382 struct regcache *newbuf;
3fadccb3
AC
383 newbuf = regcache_xmalloc (src->descr->gdbarch);
384 regcache_cpy_no_passthrough (newbuf, src);
385 return newbuf;
386}
387
388int
6ed7ea50 389regcache_valid_p (const struct regcache *regcache, int regnum)
3fadccb3
AC
390{
391 gdb_assert (regcache != NULL);
6ed7ea50
UW
392 gdb_assert (regnum >= 0);
393 if (regcache->readonly_p)
394 gdb_assert (regnum < regcache->descr->nr_cooked_registers);
395 else
396 gdb_assert (regnum < regcache->descr->nr_raw_registers);
397
51b1fe4e 398 return regcache->register_valid_p[regnum];
3fadccb3
AC
399}
400
9c5ea4d9
UW
401void
402regcache_invalidate (struct regcache *regcache, int regnum)
403{
404 gdb_assert (regcache != NULL);
405 gdb_assert (regnum >= 0);
406 gdb_assert (!regcache->readonly_p);
407 gdb_assert (regnum < regcache->descr->nr_raw_registers);
408 regcache->register_valid_p[regnum] = 0;
409}
410
411
3fadccb3
AC
412/* Global structure containing the current regcache. */
413/* FIXME: cagney/2002-05-11: The two global arrays registers[] and
8262ee23 414 deprecated_register_valid[] currently point into this structure. */
594f7785 415static struct regcache *current_regcache;
3fadccb3 416
5ebd2499 417/* NOTE: this is a write-through cache. There is no "dirty" bit for
32178cab
MS
418 recording if the register values have been changed (eg. by the
419 user). Therefore all registers must be written back to the
420 target when appropriate. */
421
594f7785
UW
422struct regcache *get_thread_regcache (ptid_t ptid)
423{
424 /* NOTE: uweigand/2007-05-05: We need to detect the thread's
425 current architecture at this point. */
426 struct gdbarch *thread_gdbarch = current_gdbarch;
427
428 if (current_regcache && ptid_equal (current_regcache->ptid, ptid)
429 && get_regcache_arch (current_regcache) == thread_gdbarch)
430 return current_regcache;
431
432 if (current_regcache)
433 regcache_xfree (current_regcache);
434
435 current_regcache = regcache_xmalloc (thread_gdbarch);
436 current_regcache->readonly_p = 0;
437 current_regcache->ptid = ptid;
438
439 return current_regcache;
440}
441
442struct regcache *get_current_regcache (void)
443{
444 return get_thread_regcache (inferior_ptid);
445}
32178cab 446
32178cab 447
f4c5303c
OF
448/* Observer for the target_changed event. */
449
450void
451regcache_observer_target_changed (struct target_ops *target)
452{
453 registers_changed ();
454}
455
32178cab
MS
456/* Low level examining and depositing of registers.
457
458 The caller is responsible for making sure that the inferior is
459 stopped before calling the fetching routines, or it will get
460 garbage. (a change from GDB version 3, in which the caller got the
461 value from the last stop). */
462
463/* REGISTERS_CHANGED ()
464
465 Indicate that registers may have changed, so invalidate the cache. */
466
467void
468registers_changed (void)
469{
470 int i;
32178cab 471
594f7785
UW
472 regcache_xfree (current_regcache);
473 current_regcache = NULL;
32178cab 474
a5d9d57d
DJ
475 /* Need to forget about any frames we have cached, too. */
476 reinit_frame_cache ();
477
32178cab
MS
478 /* Force cleanup of any alloca areas if using C alloca instead of
479 a builtin alloca. This particular call is used to clean up
480 areas allocated by low level target code which may build up
481 during lengthy interactions between gdb and the target before
482 gdb gives control to the user (ie watchpoints). */
483 alloca (0);
32178cab
MS
484}
485
32178cab 486
61a0eb5b 487void
2d522557 488regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
61a0eb5b 489{
3fadccb3
AC
490 gdb_assert (regcache != NULL && buf != NULL);
491 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
3fadccb3
AC
492 /* Make certain that the register cache is up-to-date with respect
493 to the current thread. This switching shouldn't be necessary
494 only there is still only one target side register cache. Sigh!
495 On the bright side, at least there is a regcache object. */
2d28509a 496 if (!regcache->readonly_p)
3fadccb3 497 {
594f7785 498 if (!regcache_valid_p (regcache, regnum))
3fadccb3 499 {
594f7785
UW
500 struct cleanup *old_chain = save_inferior_ptid ();
501 inferior_ptid = regcache->ptid;
502 target_fetch_registers (regcache, regnum);
503 do_cleanups (old_chain);
3fadccb3 504 }
0a8146bf
AC
505#if 0
506 /* FIXME: cagney/2004-08-07: At present a number of targets
04c663e3
DA
507 forget (or didn't know that they needed) to set this leading to
508 panics. Also is the problem that targets need to indicate
0a8146bf
AC
509 that a register is in one of the possible states: valid,
510 undefined, unknown. The last of which isn't yet
511 possible. */
9c5ea4d9 512 gdb_assert (regcache_valid_p (regcache, regnum));
0a8146bf 513#endif
3fadccb3
AC
514 }
515 /* Copy the value directly into the register cache. */
51b1fe4e 516 memcpy (buf, register_buffer (regcache, regnum),
3fadccb3 517 regcache->descr->sizeof_register[regnum]);
61a0eb5b
AC
518}
519
28fc6740
AC
520void
521regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
522{
2d522557 523 gdb_byte *buf;
28fc6740
AC
524 gdb_assert (regcache != NULL);
525 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
526 buf = alloca (regcache->descr->sizeof_register[regnum]);
527 regcache_raw_read (regcache, regnum, buf);
528 (*val) = extract_signed_integer (buf,
529 regcache->descr->sizeof_register[regnum]);
530}
531
532void
533regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
534 ULONGEST *val)
535{
2d522557 536 gdb_byte *buf;
28fc6740
AC
537 gdb_assert (regcache != NULL);
538 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
539 buf = alloca (regcache->descr->sizeof_register[regnum]);
540 regcache_raw_read (regcache, regnum, buf);
541 (*val) = extract_unsigned_integer (buf,
542 regcache->descr->sizeof_register[regnum]);
543}
544
c00dcbe9
MK
545void
546regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val)
547{
548 void *buf;
549 gdb_assert (regcache != NULL);
550 gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
551 buf = alloca (regcache->descr->sizeof_register[regnum]);
552 store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val);
553 regcache_raw_write (regcache, regnum, buf);
554}
555
556void
557regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
558 ULONGEST val)
559{
560 void *buf;
561 gdb_assert (regcache != NULL);
562 gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
563 buf = alloca (regcache->descr->sizeof_register[regnum]);
564 store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val);
565 regcache_raw_write (regcache, regnum, buf);
566}
567
68365089 568void
2d522557 569regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
68365089 570{
d138e37a 571 gdb_assert (regnum >= 0);
68365089
AC
572 gdb_assert (regnum < regcache->descr->nr_cooked_registers);
573 if (regnum < regcache->descr->nr_raw_registers)
574 regcache_raw_read (regcache, regnum, buf);
2d28509a
AC
575 else if (regcache->readonly_p
576 && regnum < regcache->descr->nr_cooked_registers
577 && regcache->register_valid_p[regnum])
b2fa5097 578 /* Read-only register cache, perhaps the cooked value was cached? */
2d28509a
AC
579 memcpy (buf, register_buffer (regcache, regnum),
580 regcache->descr->sizeof_register[regnum]);
d138e37a 581 else
68365089
AC
582 gdbarch_pseudo_register_read (regcache->descr->gdbarch, regcache,
583 regnum, buf);
61a0eb5b
AC
584}
585
a378f419
AC
586void
587regcache_cooked_read_signed (struct regcache *regcache, int regnum,
588 LONGEST *val)
589{
2d522557 590 gdb_byte *buf;
a378f419 591 gdb_assert (regcache != NULL);
a66a9c23 592 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
a378f419
AC
593 buf = alloca (regcache->descr->sizeof_register[regnum]);
594 regcache_cooked_read (regcache, regnum, buf);
595 (*val) = extract_signed_integer (buf,
596 regcache->descr->sizeof_register[regnum]);
597}
598
599void
600regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
601 ULONGEST *val)
602{
2d522557 603 gdb_byte *buf;
a378f419 604 gdb_assert (regcache != NULL);
a66a9c23 605 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
a378f419
AC
606 buf = alloca (regcache->descr->sizeof_register[regnum]);
607 regcache_cooked_read (regcache, regnum, buf);
608 (*val) = extract_unsigned_integer (buf,
609 regcache->descr->sizeof_register[regnum]);
610}
611
a66a9c23
AC
612void
613regcache_cooked_write_signed (struct regcache *regcache, int regnum,
614 LONGEST val)
615{
616 void *buf;
617 gdb_assert (regcache != NULL);
618 gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
619 buf = alloca (regcache->descr->sizeof_register[regnum]);
620 store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val);
621 regcache_cooked_write (regcache, regnum, buf);
622}
623
624void
625regcache_cooked_write_unsigned (struct regcache *regcache, int regnum,
626 ULONGEST val)
627{
628 void *buf;
629 gdb_assert (regcache != NULL);
630 gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
631 buf = alloca (regcache->descr->sizeof_register[regnum]);
632 store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val);
633 regcache_cooked_write (regcache, regnum, buf);
634}
635
61a0eb5b 636void
2d522557
AC
637regcache_raw_write (struct regcache *regcache, int regnum,
638 const gdb_byte *buf)
61a0eb5b 639{
594f7785
UW
640 struct cleanup *old_chain;
641
3fadccb3
AC
642 gdb_assert (regcache != NULL && buf != NULL);
643 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
2d28509a 644 gdb_assert (!regcache->readonly_p);
3fadccb3 645
3fadccb3
AC
646 /* On the sparc, writing %g0 is a no-op, so we don't even want to
647 change the registers array if something writes to this register. */
214e098a 648 if (gdbarch_cannot_store_register (get_regcache_arch (regcache), regnum))
3fadccb3
AC
649 return;
650
3fadccb3
AC
651 /* If we have a valid copy of the register, and new value == old
652 value, then don't bother doing the actual store. */
653 if (regcache_valid_p (regcache, regnum)
654 && (memcmp (register_buffer (regcache, regnum), buf,
655 regcache->descr->sizeof_register[regnum]) == 0))
656 return;
657
594f7785
UW
658 old_chain = save_inferior_ptid ();
659 inferior_ptid = regcache->ptid;
660
316f2060 661 target_prepare_to_store (regcache);
3fadccb3
AC
662 memcpy (register_buffer (regcache, regnum), buf,
663 regcache->descr->sizeof_register[regnum]);
51b1fe4e 664 regcache->register_valid_p[regnum] = 1;
56be3814 665 target_store_registers (regcache, regnum);
594f7785
UW
666
667 do_cleanups (old_chain);
61a0eb5b
AC
668}
669
68365089 670void
2d522557
AC
671regcache_cooked_write (struct regcache *regcache, int regnum,
672 const gdb_byte *buf)
68365089 673{
d138e37a 674 gdb_assert (regnum >= 0);
68365089
AC
675 gdb_assert (regnum < regcache->descr->nr_cooked_registers);
676 if (regnum < regcache->descr->nr_raw_registers)
677 regcache_raw_write (regcache, regnum, buf);
d138e37a 678 else
68365089 679 gdbarch_pseudo_register_write (regcache->descr->gdbarch, regcache,
d8124050 680 regnum, buf);
61a0eb5b
AC
681}
682
06c0b04e
AC
683/* Perform a partial register transfer using a read, modify, write
684 operation. */
685
686typedef void (regcache_read_ftype) (struct regcache *regcache, int regnum,
687 void *buf);
688typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum,
689 const void *buf);
690
b9362cc7 691static void
06c0b04e
AC
692regcache_xfer_part (struct regcache *regcache, int regnum,
693 int offset, int len, void *in, const void *out,
2d522557
AC
694 void (*read) (struct regcache *regcache, int regnum,
695 gdb_byte *buf),
696 void (*write) (struct regcache *regcache, int regnum,
697 const gdb_byte *buf))
06c0b04e
AC
698{
699 struct regcache_descr *descr = regcache->descr;
fc1a4b47 700 gdb_byte reg[MAX_REGISTER_SIZE];
06c0b04e
AC
701 gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]);
702 gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]);
703 /* Something to do? */
704 if (offset + len == 0)
705 return;
706 /* Read (when needed) ... */
707 if (in != NULL
708 || offset > 0
709 || offset + len < descr->sizeof_register[regnum])
710 {
711 gdb_assert (read != NULL);
712 read (regcache, regnum, reg);
713 }
714 /* ... modify ... */
715 if (in != NULL)
716 memcpy (in, reg + offset, len);
717 if (out != NULL)
718 memcpy (reg + offset, out, len);
719 /* ... write (when needed). */
720 if (out != NULL)
721 {
722 gdb_assert (write != NULL);
723 write (regcache, regnum, reg);
724 }
725}
726
727void
728regcache_raw_read_part (struct regcache *regcache, int regnum,
2d522557 729 int offset, int len, gdb_byte *buf)
06c0b04e
AC
730{
731 struct regcache_descr *descr = regcache->descr;
732 gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
733 regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
734 regcache_raw_read, regcache_raw_write);
735}
736
737void
738regcache_raw_write_part (struct regcache *regcache, int regnum,
2d522557 739 int offset, int len, const gdb_byte *buf)
06c0b04e
AC
740{
741 struct regcache_descr *descr = regcache->descr;
742 gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
743 regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
744 regcache_raw_read, regcache_raw_write);
745}
746
747void
748regcache_cooked_read_part (struct regcache *regcache, int regnum,
2d522557 749 int offset, int len, gdb_byte *buf)
06c0b04e
AC
750{
751 struct regcache_descr *descr = regcache->descr;
752 gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
753 regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
754 regcache_cooked_read, regcache_cooked_write);
755}
756
757void
758regcache_cooked_write_part (struct regcache *regcache, int regnum,
2d522557 759 int offset, int len, const gdb_byte *buf)
06c0b04e
AC
760{
761 struct regcache_descr *descr = regcache->descr;
762 gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
763 regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
764 regcache_cooked_read, regcache_cooked_write);
765}
32178cab 766
a16d75cc 767/* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */
9a661b68
MK
768
769void
6618125d 770regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf)
9a661b68
MK
771{
772 void *regbuf;
773 size_t size;
774
a16d75cc 775 gdb_assert (regcache != NULL);
9a661b68
MK
776 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
777 gdb_assert (!regcache->readonly_p);
778
9a661b68
MK
779 regbuf = register_buffer (regcache, regnum);
780 size = regcache->descr->sizeof_register[regnum];
781
782 if (buf)
783 memcpy (regbuf, buf, size);
784 else
785 memset (regbuf, 0, size);
786
787 /* Mark the register as cached. */
788 regcache->register_valid_p[regnum] = 1;
789}
790
791/* Collect register REGNUM from REGCACHE and store its contents in BUF. */
792
793void
6618125d 794regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
9a661b68
MK
795{
796 const void *regbuf;
797 size_t size;
798
799 gdb_assert (regcache != NULL && buf != NULL);
800 gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
801
802 regbuf = register_buffer (regcache, regnum);
803 size = regcache->descr->sizeof_register[regnum];
804 memcpy (buf, regbuf, size);
805}
806
193cb69f 807
fb4443d8 808/* read_pc, write_pc, etc. Special handling for register PC. */
32178cab 809
9c8dbfa9
AC
810/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc() and
811 read_sp(), will eventually be replaced by per-frame methods.
812 Instead of relying on the global INFERIOR_PTID, they will use the
813 contextual information provided by the FRAME. These functions do
814 not belong in the register cache. */
32178cab 815
cde9ea48 816/* NOTE: cagney/2003-06-07: The functions generic_target_write_pc(),
9c8dbfa9
AC
817 write_pc_pid() and write_pc(), all need to be replaced by something
818 that does not rely on global state. But what? */
32178cab
MS
819
820CORE_ADDR
39f77062 821read_pc_pid (ptid_t ptid)
32178cab 822{
594f7785 823 struct regcache *regcache = get_thread_regcache (ptid);
61a1198a
UW
824 struct gdbarch *gdbarch = get_regcache_arch (regcache);
825
32178cab
MS
826 CORE_ADDR pc_val;
827
61a1198a
UW
828 if (gdbarch_read_pc_p (gdbarch))
829 pc_val = gdbarch_read_pc (gdbarch, regcache);
cde9ea48 830 /* Else use per-frame method on get_current_frame. */
214e098a 831 else if (gdbarch_pc_regnum (gdbarch) >= 0)
cde9ea48 832 {
61a1198a 833 ULONGEST raw_val;
3e8c568d 834 regcache_cooked_read_unsigned (regcache,
214e098a 835 gdbarch_pc_regnum (gdbarch),
3e8c568d 836 &raw_val);
214e098a 837 pc_val = gdbarch_addr_bits_remove (gdbarch, raw_val);
cde9ea48
AC
838 }
839 else
e2e0b3e5 840 internal_error (__FILE__, __LINE__, _("read_pc_pid: Unable to find PC"));
32178cab 841
32178cab
MS
842 return pc_val;
843}
844
845CORE_ADDR
846read_pc (void)
847{
39f77062 848 return read_pc_pid (inferior_ptid);
32178cab
MS
849}
850
32178cab 851void
39f77062 852write_pc_pid (CORE_ADDR pc, ptid_t ptid)
32178cab 853{
594f7785 854 struct regcache *regcache = get_thread_regcache (ptid);
61a1198a
UW
855 struct gdbarch *gdbarch = get_regcache_arch (regcache);
856
61a1198a
UW
857 if (gdbarch_write_pc_p (gdbarch))
858 gdbarch_write_pc (gdbarch, regcache, pc);
214e098a 859 else if (gdbarch_pc_regnum (gdbarch) >= 0)
3e8c568d 860 regcache_cooked_write_unsigned (regcache,
214e098a 861 gdbarch_pc_regnum (gdbarch), pc);
61a1198a
UW
862 else
863 internal_error (__FILE__, __LINE__,
864 _("write_pc_pid: Unable to update PC"));
32178cab
MS
865}
866
867void
868write_pc (CORE_ADDR pc)
869{
39f77062 870 write_pc_pid (pc, inferior_ptid);
32178cab
MS
871}
872
32178cab 873
705152c5
MS
874static void
875reg_flush_command (char *command, int from_tty)
876{
877 /* Force-flush the register cache. */
878 registers_changed ();
879 if (from_tty)
a3f17187 880 printf_filtered (_("Register cache flushed.\n"));
705152c5
MS
881}
882
af030b9a
AC
883static void
884dump_endian_bytes (struct ui_file *file, enum bfd_endian endian,
885 const unsigned char *buf, long len)
886{
887 int i;
888 switch (endian)
889 {
890 case BFD_ENDIAN_BIG:
891 for (i = 0; i < len; i++)
892 fprintf_unfiltered (file, "%02x", buf[i]);
893 break;
894 case BFD_ENDIAN_LITTLE:
895 for (i = len - 1; i >= 0; i--)
896 fprintf_unfiltered (file, "%02x", buf[i]);
897 break;
898 default:
e2e0b3e5 899 internal_error (__FILE__, __LINE__, _("Bad switch"));
af030b9a
AC
900 }
901}
902
903enum regcache_dump_what
904{
b59ff9d5 905 regcache_dump_none, regcache_dump_raw, regcache_dump_cooked, regcache_dump_groups
af030b9a
AC
906};
907
908static void
909regcache_dump (struct regcache *regcache, struct ui_file *file,
910 enum regcache_dump_what what_to_dump)
911{
912 struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
b59ff9d5 913 struct gdbarch *gdbarch = regcache->descr->gdbarch;
af030b9a
AC
914 int regnum;
915 int footnote_nr = 0;
916 int footnote_register_size = 0;
917 int footnote_register_offset = 0;
918 int footnote_register_type_name_null = 0;
919 long register_offset = 0;
123a958e 920 unsigned char buf[MAX_REGISTER_SIZE];
af030b9a
AC
921
922#if 0
af030b9a
AC
923 fprintf_unfiltered (file, "nr_raw_registers %d\n",
924 regcache->descr->nr_raw_registers);
925 fprintf_unfiltered (file, "nr_cooked_registers %d\n",
926 regcache->descr->nr_cooked_registers);
927 fprintf_unfiltered (file, "sizeof_raw_registers %ld\n",
928 regcache->descr->sizeof_raw_registers);
929 fprintf_unfiltered (file, "sizeof_raw_register_valid_p %ld\n",
930 regcache->descr->sizeof_raw_register_valid_p);
f57d151a 931 fprintf_unfiltered (file, "gdbarch_num_regs %d\n",
214e098a 932 gdbarch_num_regs (gdbarch));
f57d151a 933 fprintf_unfiltered (file, "gdbarch_num_pseudo_regs %d\n",
214e098a 934 gdbarch_num_pseudo_regs (gdbarch));
af030b9a
AC
935#endif
936
937 gdb_assert (regcache->descr->nr_cooked_registers
214e098a
UW
938 == (gdbarch_num_regs (gdbarch)
939 + gdbarch_num_pseudo_regs (gdbarch)));
af030b9a
AC
940
941 for (regnum = -1; regnum < regcache->descr->nr_cooked_registers; regnum++)
942 {
943 /* Name. */
944 if (regnum < 0)
945 fprintf_unfiltered (file, " %-10s", "Name");
946 else
947 {
214e098a 948 const char *p = gdbarch_register_name (gdbarch, regnum);
af030b9a
AC
949 if (p == NULL)
950 p = "";
951 else if (p[0] == '\0')
952 p = "''";
953 fprintf_unfiltered (file, " %-10s", p);
954 }
955
956 /* Number. */
957 if (regnum < 0)
958 fprintf_unfiltered (file, " %4s", "Nr");
959 else
960 fprintf_unfiltered (file, " %4d", regnum);
961
962 /* Relative number. */
963 if (regnum < 0)
964 fprintf_unfiltered (file, " %4s", "Rel");
214e098a 965 else if (regnum < gdbarch_num_regs (gdbarch))
af030b9a
AC
966 fprintf_unfiltered (file, " %4d", regnum);
967 else
f57d151a 968 fprintf_unfiltered (file, " %4d",
214e098a 969 (regnum - gdbarch_num_regs (gdbarch)));
af030b9a
AC
970
971 /* Offset. */
972 if (regnum < 0)
973 fprintf_unfiltered (file, " %6s ", "Offset");
974 else
975 {
976 fprintf_unfiltered (file, " %6ld",
977 regcache->descr->register_offset[regnum]);
a7e3c2ad 978 if (register_offset != regcache->descr->register_offset[regnum]
d3b22ed5
AC
979 || (regnum > 0
980 && (regcache->descr->register_offset[regnum]
981 != (regcache->descr->register_offset[regnum - 1]
982 + regcache->descr->sizeof_register[regnum - 1])))
983 )
af030b9a
AC
984 {
985 if (!footnote_register_offset)
986 footnote_register_offset = ++footnote_nr;
987 fprintf_unfiltered (file, "*%d", footnote_register_offset);
988 }
989 else
990 fprintf_unfiltered (file, " ");
991 register_offset = (regcache->descr->register_offset[regnum]
992 + regcache->descr->sizeof_register[regnum]);
993 }
994
995 /* Size. */
996 if (regnum < 0)
997 fprintf_unfiltered (file, " %5s ", "Size");
998 else
01e1877c
AC
999 fprintf_unfiltered (file, " %5ld",
1000 regcache->descr->sizeof_register[regnum]);
af030b9a
AC
1001
1002 /* Type. */
b59ff9d5
AC
1003 {
1004 const char *t;
1005 if (regnum < 0)
1006 t = "Type";
1007 else
1008 {
1009 static const char blt[] = "builtin_type";
1010 t = TYPE_NAME (register_type (regcache->descr->gdbarch, regnum));
1011 if (t == NULL)
1012 {
1013 char *n;
1014 if (!footnote_register_type_name_null)
1015 footnote_register_type_name_null = ++footnote_nr;
b435e160 1016 n = xstrprintf ("*%d", footnote_register_type_name_null);
b59ff9d5
AC
1017 make_cleanup (xfree, n);
1018 t = n;
1019 }
1020 /* Chop a leading builtin_type. */
1021 if (strncmp (t, blt, strlen (blt)) == 0)
1022 t += strlen (blt);
1023 }
1024 fprintf_unfiltered (file, " %-15s", t);
1025 }
1026
1027 /* Leading space always present. */
1028 fprintf_unfiltered (file, " ");
af030b9a
AC
1029
1030 /* Value, raw. */
1031 if (what_to_dump == regcache_dump_raw)
1032 {
1033 if (regnum < 0)
1034 fprintf_unfiltered (file, "Raw value");
1035 else if (regnum >= regcache->descr->nr_raw_registers)
1036 fprintf_unfiltered (file, "<cooked>");
1037 else if (!regcache_valid_p (regcache, regnum))
1038 fprintf_unfiltered (file, "<invalid>");
1039 else
1040 {
1041 regcache_raw_read (regcache, regnum, buf);
1042 fprintf_unfiltered (file, "0x");
0d20ae72 1043 dump_endian_bytes (file,
214e098a 1044 gdbarch_byte_order (gdbarch), buf,
01e1877c 1045 regcache->descr->sizeof_register[regnum]);
af030b9a
AC
1046 }
1047 }
1048
1049 /* Value, cooked. */
1050 if (what_to_dump == regcache_dump_cooked)
1051 {
1052 if (regnum < 0)
1053 fprintf_unfiltered (file, "Cooked value");
1054 else
1055 {
1056 regcache_cooked_read (regcache, regnum, buf);
1057 fprintf_unfiltered (file, "0x");
0d20ae72 1058 dump_endian_bytes (file,
214e098a 1059 gdbarch_byte_order (gdbarch), buf,
01e1877c 1060 regcache->descr->sizeof_register[regnum]);
af030b9a
AC
1061 }
1062 }
1063
b59ff9d5
AC
1064 /* Group members. */
1065 if (what_to_dump == regcache_dump_groups)
1066 {
1067 if (regnum < 0)
1068 fprintf_unfiltered (file, "Groups");
1069 else
1070 {
b59ff9d5 1071 const char *sep = "";
6c7d17ba
AC
1072 struct reggroup *group;
1073 for (group = reggroup_next (gdbarch, NULL);
1074 group != NULL;
1075 group = reggroup_next (gdbarch, group))
b59ff9d5 1076 {
6c7d17ba 1077 if (gdbarch_register_reggroup_p (gdbarch, regnum, group))
b59ff9d5 1078 {
6c7d17ba 1079 fprintf_unfiltered (file, "%s%s", sep, reggroup_name (group));
b59ff9d5
AC
1080 sep = ",";
1081 }
1082 }
1083 }
1084 }
1085
af030b9a
AC
1086 fprintf_unfiltered (file, "\n");
1087 }
1088
1089 if (footnote_register_size)
1090 fprintf_unfiltered (file, "*%d: Inconsistent register sizes.\n",
1091 footnote_register_size);
1092 if (footnote_register_offset)
1093 fprintf_unfiltered (file, "*%d: Inconsistent register offsets.\n",
1094 footnote_register_offset);
1095 if (footnote_register_type_name_null)
1096 fprintf_unfiltered (file,
1097 "*%d: Register type's name NULL.\n",
1098 footnote_register_type_name_null);
1099 do_cleanups (cleanups);
1100}
1101
1102static void
1103regcache_print (char *args, enum regcache_dump_what what_to_dump)
1104{
1105 if (args == NULL)
28c38f10 1106 regcache_dump (get_current_regcache (), gdb_stdout, what_to_dump);
af030b9a
AC
1107 else
1108 {
1109 struct ui_file *file = gdb_fopen (args, "w");
1110 if (file == NULL)
e2e0b3e5 1111 perror_with_name (_("maintenance print architecture"));
28c38f10 1112 regcache_dump (get_current_regcache (), file, what_to_dump);
af030b9a
AC
1113 ui_file_delete (file);
1114 }
1115}
1116
1117static void
1118maintenance_print_registers (char *args, int from_tty)
1119{
1120 regcache_print (args, regcache_dump_none);
1121}
1122
1123static void
1124maintenance_print_raw_registers (char *args, int from_tty)
1125{
1126 regcache_print (args, regcache_dump_raw);
1127}
1128
1129static void
1130maintenance_print_cooked_registers (char *args, int from_tty)
1131{
1132 regcache_print (args, regcache_dump_cooked);
1133}
1134
b59ff9d5
AC
1135static void
1136maintenance_print_register_groups (char *args, int from_tty)
1137{
1138 regcache_print (args, regcache_dump_groups);
1139}
1140
b9362cc7
AC
1141extern initialize_file_ftype _initialize_regcache; /* -Wmissing-prototype */
1142
32178cab
MS
1143void
1144_initialize_regcache (void)
1145{
030f20e1 1146 regcache_descr_handle = gdbarch_data_register_post_init (init_regcache_descr);
705152c5 1147
f4c5303c
OF
1148 observer_attach_target_changed (regcache_observer_target_changed);
1149
705152c5 1150 add_com ("flushregs", class_maintenance, reg_flush_command,
1bedd215 1151 _("Force gdb to flush its register cache (maintainer command)"));
39f77062 1152
1a966eab
AC
1153 add_cmd ("registers", class_maintenance, maintenance_print_registers, _("\
1154Print the internal register configuration.\n\
1155Takes an optional file parameter."), &maintenanceprintlist);
af030b9a 1156 add_cmd ("raw-registers", class_maintenance,
1a966eab
AC
1157 maintenance_print_raw_registers, _("\
1158Print the internal register configuration including raw values.\n\
1159Takes an optional file parameter."), &maintenanceprintlist);
af030b9a 1160 add_cmd ("cooked-registers", class_maintenance,
1a966eab
AC
1161 maintenance_print_cooked_registers, _("\
1162Print the internal register configuration including cooked values.\n\
1163Takes an optional file parameter."), &maintenanceprintlist);
b59ff9d5 1164 add_cmd ("register-groups", class_maintenance,
1a966eab
AC
1165 maintenance_print_register_groups, _("\
1166Print the internal register configuration including each register's group.\n\
1167Takes an optional file parameter."),
af030b9a
AC
1168 &maintenanceprintlist);
1169
32178cab 1170}
This page took 1.05509 seconds and 4 git commands to generate.