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