1 /* Cache and manage the values of registers for GDB, the GNU debugger.
3 Copyright (C) 1986-2014 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 #include "reggroups.h"
28 #include "exceptions.h"
36 * Here is the actual register cache.
39 /* Per-architecture object describing the layout of a register cache.
40 Computed once when the architecture is created. */
42 struct gdbarch_data
*regcache_descr_handle
;
46 /* The architecture this descriptor belongs to. */
47 struct gdbarch
*gdbarch
;
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
52 registers then those registers and not the PC lives in the raw
55 long sizeof_raw_registers
;
56 long sizeof_raw_register_status
;
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
61 .. NR_COOKED_REGISTERS) (a.k.a. pseudo registers) are mapped onto
62 both raw registers and memory by the architecture methods
63 gdbarch_pseudo_register_read and gdbarch_pseudo_register_write. */
64 int nr_cooked_registers
;
65 long sizeof_cooked_registers
;
66 long sizeof_cooked_register_status
;
68 /* Offset and size (in 8 bit bytes), of each register in the
69 register cache. All registers (including those in the range
70 [NR_RAW_REGISTERS .. NR_COOKED_REGISTERS) are given an
72 long *register_offset
;
73 long *sizeof_register
;
75 /* Cached table containing the type of each register. */
76 struct type
**register_type
;
80 init_regcache_descr (struct gdbarch
*gdbarch
)
83 struct regcache_descr
*descr
;
84 gdb_assert (gdbarch
!= NULL
);
86 /* Create an initial, zero filled, table. */
87 descr
= GDBARCH_OBSTACK_ZALLOC (gdbarch
, struct regcache_descr
);
88 descr
->gdbarch
= gdbarch
;
90 /* Total size of the register space. The raw registers are mapped
91 directly onto the raw register cache while the pseudo's are
92 either mapped onto raw-registers or memory. */
93 descr
->nr_cooked_registers
= gdbarch_num_regs (gdbarch
)
94 + gdbarch_num_pseudo_regs (gdbarch
);
95 descr
->sizeof_cooked_register_status
96 = gdbarch_num_regs (gdbarch
) + gdbarch_num_pseudo_regs (gdbarch
);
98 /* Fill in a table of register types. */
100 = GDBARCH_OBSTACK_CALLOC (gdbarch
, descr
->nr_cooked_registers
,
102 for (i
= 0; i
< descr
->nr_cooked_registers
; i
++)
103 descr
->register_type
[i
] = gdbarch_register_type (gdbarch
, i
);
105 /* Construct a strictly RAW register cache. Don't allow pseudo's
106 into the register cache. */
107 descr
->nr_raw_registers
= gdbarch_num_regs (gdbarch
);
108 descr
->sizeof_raw_register_status
= gdbarch_num_regs (gdbarch
);
110 /* Lay out the register cache.
112 NOTE: cagney/2002-05-22: Only register_type() is used when
113 constructing the register cache. It is assumed that the
114 register's raw size, virtual size and type length are all the
120 descr
->sizeof_register
121 = GDBARCH_OBSTACK_CALLOC (gdbarch
, descr
->nr_cooked_registers
, long);
122 descr
->register_offset
123 = GDBARCH_OBSTACK_CALLOC (gdbarch
, descr
->nr_cooked_registers
, long);
124 for (i
= 0; i
< descr
->nr_raw_registers
; i
++)
126 descr
->sizeof_register
[i
] = TYPE_LENGTH (descr
->register_type
[i
]);
127 descr
->register_offset
[i
] = offset
;
128 offset
+= descr
->sizeof_register
[i
];
129 gdb_assert (MAX_REGISTER_SIZE
>= descr
->sizeof_register
[i
]);
131 /* Set the real size of the raw register cache buffer. */
132 descr
->sizeof_raw_registers
= offset
;
134 for (; i
< descr
->nr_cooked_registers
; i
++)
136 descr
->sizeof_register
[i
] = TYPE_LENGTH (descr
->register_type
[i
]);
137 descr
->register_offset
[i
] = offset
;
138 offset
+= descr
->sizeof_register
[i
];
139 gdb_assert (MAX_REGISTER_SIZE
>= descr
->sizeof_register
[i
]);
141 /* Set the real size of the readonly register cache buffer. */
142 descr
->sizeof_cooked_registers
= offset
;
148 static struct regcache_descr
*
149 regcache_descr (struct gdbarch
*gdbarch
)
151 return gdbarch_data (gdbarch
, regcache_descr_handle
);
154 /* Utility functions returning useful register attributes stored in
155 the regcache descr. */
158 register_type (struct gdbarch
*gdbarch
, int regnum
)
160 struct regcache_descr
*descr
= regcache_descr (gdbarch
);
162 gdb_assert (regnum
>= 0 && regnum
< descr
->nr_cooked_registers
);
163 return descr
->register_type
[regnum
];
166 /* Utility functions returning useful register attributes stored in
167 the regcache descr. */
170 register_size (struct gdbarch
*gdbarch
, int regnum
)
172 struct regcache_descr
*descr
= regcache_descr (gdbarch
);
175 gdb_assert (regnum
>= 0
176 && regnum
< (gdbarch_num_regs (gdbarch
)
177 + gdbarch_num_pseudo_regs (gdbarch
)));
178 size
= descr
->sizeof_register
[regnum
];
182 /* The register cache for storing raw register values. */
186 struct regcache_descr
*descr
;
188 /* The address space of this register cache (for registers where it
189 makes sense, like PC or SP). */
190 struct address_space
*aspace
;
192 /* The register buffers. A read-only register cache can hold the
193 full [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs) while a read/write
194 register cache can only hold [0 .. gdbarch_num_regs). */
196 /* Register cache status. */
197 signed char *register_status
;
198 /* Is this a read-only cache? A read-only cache is used for saving
199 the target's register state (e.g, across an inferior function
200 call or just before forcing a function return). A read-only
201 cache can only be updated via the methods regcache_dup() and
202 regcache_cpy(). The actual contents are determined by the
203 reggroup_save and reggroup_restore methods. */
205 /* If this is a read-write cache, which thread's registers is
210 static struct regcache
*
211 regcache_xmalloc_1 (struct gdbarch
*gdbarch
, struct address_space
*aspace
,
214 struct regcache_descr
*descr
;
215 struct regcache
*regcache
;
217 gdb_assert (gdbarch
!= NULL
);
218 descr
= regcache_descr (gdbarch
);
219 regcache
= XNEW (struct regcache
);
220 regcache
->descr
= descr
;
221 regcache
->readonly_p
= readonly_p
;
225 = XCNEWVEC (gdb_byte
, descr
->sizeof_cooked_registers
);
226 regcache
->register_status
227 = XCNEWVEC (signed char, descr
->sizeof_cooked_register_status
);
232 = XCNEWVEC (gdb_byte
, descr
->sizeof_raw_registers
);
233 regcache
->register_status
234 = XCNEWVEC (signed char, descr
->sizeof_raw_register_status
);
236 regcache
->aspace
= aspace
;
237 regcache
->ptid
= minus_one_ptid
;
242 regcache_xmalloc (struct gdbarch
*gdbarch
, struct address_space
*aspace
)
244 return regcache_xmalloc_1 (gdbarch
, aspace
, 1);
248 regcache_xfree (struct regcache
*regcache
)
250 if (regcache
== NULL
)
252 xfree (regcache
->registers
);
253 xfree (regcache
->register_status
);
258 do_regcache_xfree (void *data
)
260 regcache_xfree (data
);
264 make_cleanup_regcache_xfree (struct regcache
*regcache
)
266 return make_cleanup (do_regcache_xfree
, regcache
);
269 /* Cleanup routines for invalidating a register. */
271 struct register_to_invalidate
273 struct regcache
*regcache
;
278 do_regcache_invalidate (void *data
)
280 struct register_to_invalidate
*reg
= data
;
282 regcache_invalidate (reg
->regcache
, reg
->regnum
);
285 static struct cleanup
*
286 make_cleanup_regcache_invalidate (struct regcache
*regcache
, int regnum
)
288 struct register_to_invalidate
* reg
= XNEW (struct register_to_invalidate
);
290 reg
->regcache
= regcache
;
291 reg
->regnum
= regnum
;
292 return make_cleanup_dtor (do_regcache_invalidate
, (void *) reg
, xfree
);
295 /* Return REGCACHE's architecture. */
298 get_regcache_arch (const struct regcache
*regcache
)
300 return regcache
->descr
->gdbarch
;
303 struct address_space
*
304 get_regcache_aspace (const struct regcache
*regcache
)
306 return regcache
->aspace
;
309 /* Return a pointer to register REGNUM's buffer cache. */
312 register_buffer (const struct regcache
*regcache
, int regnum
)
314 return regcache
->registers
+ regcache
->descr
->register_offset
[regnum
];
318 regcache_save (struct regcache
*dst
, regcache_cooked_read_ftype
*cooked_read
,
321 struct gdbarch
*gdbarch
= dst
->descr
->gdbarch
;
322 gdb_byte buf
[MAX_REGISTER_SIZE
];
325 /* The DST should be `read-only', if it wasn't then the save would
326 end up trying to write the register values back out to the
328 gdb_assert (dst
->readonly_p
);
329 /* Clear the dest. */
330 memset (dst
->registers
, 0, dst
->descr
->sizeof_cooked_registers
);
331 memset (dst
->register_status
, 0,
332 dst
->descr
->sizeof_cooked_register_status
);
333 /* Copy over any registers (identified by their membership in the
334 save_reggroup) and mark them as valid. The full [0 .. gdbarch_num_regs +
335 gdbarch_num_pseudo_regs) range is checked since some architectures need
336 to save/restore `cooked' registers that live in memory. */
337 for (regnum
= 0; regnum
< dst
->descr
->nr_cooked_registers
; regnum
++)
339 if (gdbarch_register_reggroup_p (gdbarch
, regnum
, save_reggroup
))
341 enum register_status status
= cooked_read (src
, regnum
, buf
);
343 if (status
== REG_VALID
)
344 memcpy (register_buffer (dst
, regnum
), buf
,
345 register_size (gdbarch
, regnum
));
348 gdb_assert (status
!= REG_UNKNOWN
);
350 memset (register_buffer (dst
, regnum
), 0,
351 register_size (gdbarch
, regnum
));
353 dst
->register_status
[regnum
] = status
;
359 regcache_restore (struct regcache
*dst
,
360 regcache_cooked_read_ftype
*cooked_read
,
361 void *cooked_read_context
)
363 struct gdbarch
*gdbarch
= dst
->descr
->gdbarch
;
364 gdb_byte buf
[MAX_REGISTER_SIZE
];
367 /* The dst had better not be read-only. If it is, the `restore'
368 doesn't make much sense. */
369 gdb_assert (!dst
->readonly_p
);
370 /* Copy over any registers, being careful to only restore those that
371 were both saved and need to be restored. The full [0 .. gdbarch_num_regs
372 + gdbarch_num_pseudo_regs) range is checked since some architectures need
373 to save/restore `cooked' registers that live in memory. */
374 for (regnum
= 0; regnum
< dst
->descr
->nr_cooked_registers
; regnum
++)
376 if (gdbarch_register_reggroup_p (gdbarch
, regnum
, restore_reggroup
))
378 enum register_status status
;
380 status
= cooked_read (cooked_read_context
, regnum
, buf
);
381 if (status
== REG_VALID
)
382 regcache_cooked_write (dst
, regnum
, buf
);
387 static enum register_status
388 do_cooked_read (void *src
, int regnum
, gdb_byte
*buf
)
390 struct regcache
*regcache
= src
;
392 return regcache_cooked_read (regcache
, regnum
, buf
);
396 regcache_cpy (struct regcache
*dst
, struct regcache
*src
)
398 gdb_assert (src
!= NULL
&& dst
!= NULL
);
399 gdb_assert (src
->descr
->gdbarch
== dst
->descr
->gdbarch
);
400 gdb_assert (src
!= dst
);
401 gdb_assert (src
->readonly_p
|| dst
->readonly_p
);
403 if (!src
->readonly_p
)
404 regcache_save (dst
, do_cooked_read
, src
);
405 else if (!dst
->readonly_p
)
406 regcache_restore (dst
, do_cooked_read
, src
);
408 regcache_cpy_no_passthrough (dst
, src
);
412 regcache_cpy_no_passthrough (struct regcache
*dst
, struct regcache
*src
)
414 gdb_assert (src
!= NULL
&& dst
!= NULL
);
415 gdb_assert (src
->descr
->gdbarch
== dst
->descr
->gdbarch
);
416 /* NOTE: cagney/2002-05-17: Don't let the caller do a no-passthrough
417 move of data into a thread's regcache. Doing this would be silly
418 - it would mean that regcache->register_status would be
419 completely invalid. */
420 gdb_assert (dst
->readonly_p
&& src
->readonly_p
);
422 memcpy (dst
->registers
, src
->registers
,
423 dst
->descr
->sizeof_cooked_registers
);
424 memcpy (dst
->register_status
, src
->register_status
,
425 dst
->descr
->sizeof_cooked_register_status
);
429 regcache_dup (struct regcache
*src
)
431 struct regcache
*newbuf
;
433 newbuf
= regcache_xmalloc (src
->descr
->gdbarch
, get_regcache_aspace (src
));
434 regcache_cpy (newbuf
, src
);
439 regcache_register_status (const struct regcache
*regcache
, int regnum
)
441 gdb_assert (regcache
!= NULL
);
442 gdb_assert (regnum
>= 0);
443 if (regcache
->readonly_p
)
444 gdb_assert (regnum
< regcache
->descr
->nr_cooked_registers
);
446 gdb_assert (regnum
< regcache
->descr
->nr_raw_registers
);
448 return regcache
->register_status
[regnum
];
452 regcache_invalidate (struct regcache
*regcache
, int regnum
)
454 gdb_assert (regcache
!= NULL
);
455 gdb_assert (regnum
>= 0);
456 gdb_assert (!regcache
->readonly_p
);
457 gdb_assert (regnum
< regcache
->descr
->nr_raw_registers
);
458 regcache
->register_status
[regnum
] = REG_UNKNOWN
;
462 /* Global structure containing the current regcache. */
464 /* NOTE: this is a write-through cache. There is no "dirty" bit for
465 recording if the register values have been changed (eg. by the
466 user). Therefore all registers must be written back to the
467 target when appropriate. */
471 struct regcache
*regcache
;
472 struct regcache_list
*next
;
475 static struct regcache_list
*current_regcache
;
478 get_thread_arch_aspace_regcache (ptid_t ptid
, struct gdbarch
*gdbarch
,
479 struct address_space
*aspace
)
481 struct regcache_list
*list
;
482 struct regcache
*new_regcache
;
484 for (list
= current_regcache
; list
; list
= list
->next
)
485 if (ptid_equal (list
->regcache
->ptid
, ptid
)
486 && get_regcache_arch (list
->regcache
) == gdbarch
)
487 return list
->regcache
;
489 new_regcache
= regcache_xmalloc_1 (gdbarch
, aspace
, 0);
490 new_regcache
->ptid
= ptid
;
492 list
= xmalloc (sizeof (struct regcache_list
));
493 list
->regcache
= new_regcache
;
494 list
->next
= current_regcache
;
495 current_regcache
= list
;
501 get_thread_arch_regcache (ptid_t ptid
, struct gdbarch
*gdbarch
)
503 struct address_space
*aspace
;
505 /* For the benefit of "maint print registers" & co when debugging an
506 executable, allow dumping the regcache even when there is no
507 thread selected (target_thread_address_space internal-errors if
508 no address space is found). Note that normal user commands will
509 fail higher up on the call stack due to no
510 target_has_registers. */
511 aspace
= (ptid_equal (null_ptid
, ptid
)
513 : target_thread_address_space (ptid
));
515 return get_thread_arch_aspace_regcache (ptid
, gdbarch
, aspace
);
518 static ptid_t current_thread_ptid
;
519 static struct gdbarch
*current_thread_arch
;
522 get_thread_regcache (ptid_t ptid
)
524 if (!current_thread_arch
|| !ptid_equal (current_thread_ptid
, ptid
))
526 current_thread_ptid
= ptid
;
527 current_thread_arch
= target_thread_architecture (ptid
);
530 return get_thread_arch_regcache (ptid
, current_thread_arch
);
534 get_current_regcache (void)
536 return get_thread_regcache (inferior_ptid
);
539 /* See common/common-regcache.h. */
542 get_thread_regcache_for_ptid (ptid_t ptid
)
544 return get_thread_regcache (ptid
);
547 /* Observer for the target_changed event. */
550 regcache_observer_target_changed (struct target_ops
*target
)
552 registers_changed ();
555 /* Update global variables old ptids to hold NEW_PTID if they were
558 regcache_thread_ptid_changed (ptid_t old_ptid
, ptid_t new_ptid
)
560 struct regcache_list
*list
;
562 for (list
= current_regcache
; list
; list
= list
->next
)
563 if (ptid_equal (list
->regcache
->ptid
, old_ptid
))
564 list
->regcache
->ptid
= new_ptid
;
567 /* Low level examining and depositing of registers.
569 The caller is responsible for making sure that the inferior is
570 stopped before calling the fetching routines, or it will get
571 garbage. (a change from GDB version 3, in which the caller got the
572 value from the last stop). */
574 /* REGISTERS_CHANGED ()
576 Indicate that registers may have changed, so invalidate the cache. */
579 registers_changed_ptid (ptid_t ptid
)
581 struct regcache_list
*list
, **list_link
;
583 list
= current_regcache
;
584 list_link
= ¤t_regcache
;
587 if (ptid_match (list
->regcache
->ptid
, ptid
))
589 struct regcache_list
*dead
= list
;
591 *list_link
= list
->next
;
592 regcache_xfree (list
->regcache
);
598 list_link
= &list
->next
;
602 if (ptid_match (current_thread_ptid
, ptid
))
604 current_thread_ptid
= null_ptid
;
605 current_thread_arch
= NULL
;
608 if (ptid_match (inferior_ptid
, ptid
))
610 /* We just deleted the regcache of the current thread. Need to
611 forget about any frames we have cached, too. */
612 reinit_frame_cache ();
617 registers_changed (void)
619 registers_changed_ptid (minus_one_ptid
);
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). */
630 regcache_raw_read (struct regcache
*regcache
, int regnum
, gdb_byte
*buf
)
632 gdb_assert (regcache
!= NULL
&& buf
!= NULL
);
633 gdb_assert (regnum
>= 0 && regnum
< regcache
->descr
->nr_raw_registers
);
634 /* Make certain that the register cache is up-to-date with respect
635 to the current thread. This switching shouldn't be necessary
636 only there is still only one target side register cache. Sigh!
637 On the bright side, at least there is a regcache object. */
638 if (!regcache
->readonly_p
639 && regcache_register_status (regcache
, regnum
) == REG_UNKNOWN
)
641 struct cleanup
*old_chain
= save_inferior_ptid ();
643 inferior_ptid
= regcache
->ptid
;
644 target_fetch_registers (regcache
, regnum
);
645 do_cleanups (old_chain
);
647 /* A number of targets can't access the whole set of raw
648 registers (because the debug API provides no means to get at
650 if (regcache
->register_status
[regnum
] == REG_UNKNOWN
)
651 regcache
->register_status
[regnum
] = REG_UNAVAILABLE
;
654 if (regcache
->register_status
[regnum
] != REG_VALID
)
655 memset (buf
, 0, regcache
->descr
->sizeof_register
[regnum
]);
657 memcpy (buf
, register_buffer (regcache
, regnum
),
658 regcache
->descr
->sizeof_register
[regnum
]);
660 return regcache
->register_status
[regnum
];
664 regcache_raw_read_signed (struct regcache
*regcache
, int regnum
, LONGEST
*val
)
667 enum register_status status
;
669 gdb_assert (regcache
!= NULL
);
670 gdb_assert (regnum
>= 0 && regnum
< regcache
->descr
->nr_raw_registers
);
671 buf
= alloca (regcache
->descr
->sizeof_register
[regnum
]);
672 status
= regcache_raw_read (regcache
, regnum
, buf
);
673 if (status
== REG_VALID
)
674 *val
= extract_signed_integer
675 (buf
, regcache
->descr
->sizeof_register
[regnum
],
676 gdbarch_byte_order (regcache
->descr
->gdbarch
));
683 regcache_raw_read_unsigned (struct regcache
*regcache
, int regnum
,
687 enum register_status status
;
689 gdb_assert (regcache
!= NULL
);
690 gdb_assert (regnum
>= 0 && regnum
< regcache
->descr
->nr_raw_registers
);
691 buf
= alloca (regcache
->descr
->sizeof_register
[regnum
]);
692 status
= regcache_raw_read (regcache
, regnum
, buf
);
693 if (status
== REG_VALID
)
694 *val
= extract_unsigned_integer
695 (buf
, regcache
->descr
->sizeof_register
[regnum
],
696 gdbarch_byte_order (regcache
->descr
->gdbarch
));
703 regcache_raw_write_signed (struct regcache
*regcache
, int regnum
, LONGEST val
)
707 gdb_assert (regcache
!= NULL
);
708 gdb_assert (regnum
>=0 && regnum
< regcache
->descr
->nr_raw_registers
);
709 buf
= alloca (regcache
->descr
->sizeof_register
[regnum
]);
710 store_signed_integer (buf
, regcache
->descr
->sizeof_register
[regnum
],
711 gdbarch_byte_order (regcache
->descr
->gdbarch
), val
);
712 regcache_raw_write (regcache
, regnum
, buf
);
716 regcache_raw_write_unsigned (struct regcache
*regcache
, int regnum
,
721 gdb_assert (regcache
!= NULL
);
722 gdb_assert (regnum
>=0 && regnum
< regcache
->descr
->nr_raw_registers
);
723 buf
= alloca (regcache
->descr
->sizeof_register
[regnum
]);
724 store_unsigned_integer (buf
, regcache
->descr
->sizeof_register
[regnum
],
725 gdbarch_byte_order (regcache
->descr
->gdbarch
), val
);
726 regcache_raw_write (regcache
, regnum
, buf
);
730 regcache_cooked_read (struct regcache
*regcache
, int regnum
, gdb_byte
*buf
)
732 gdb_assert (regnum
>= 0);
733 gdb_assert (regnum
< regcache
->descr
->nr_cooked_registers
);
734 if (regnum
< regcache
->descr
->nr_raw_registers
)
735 return regcache_raw_read (regcache
, regnum
, buf
);
736 else if (regcache
->readonly_p
737 && regcache
->register_status
[regnum
] != REG_UNKNOWN
)
739 /* Read-only register cache, perhaps the cooked value was
741 if (regcache
->register_status
[regnum
] == REG_VALID
)
742 memcpy (buf
, register_buffer (regcache
, regnum
),
743 regcache
->descr
->sizeof_register
[regnum
]);
745 memset (buf
, 0, regcache
->descr
->sizeof_register
[regnum
]);
747 return regcache
->register_status
[regnum
];
749 else if (gdbarch_pseudo_register_read_value_p (regcache
->descr
->gdbarch
))
751 struct value
*mark
, *computed
;
752 enum register_status result
= REG_VALID
;
754 mark
= value_mark ();
756 computed
= gdbarch_pseudo_register_read_value (regcache
->descr
->gdbarch
,
758 if (value_entirely_available (computed
))
759 memcpy (buf
, value_contents_raw (computed
),
760 regcache
->descr
->sizeof_register
[regnum
]);
763 memset (buf
, 0, regcache
->descr
->sizeof_register
[regnum
]);
764 result
= REG_UNAVAILABLE
;
767 value_free_to_mark (mark
);
772 return gdbarch_pseudo_register_read (regcache
->descr
->gdbarch
, regcache
,
777 regcache_cooked_read_value (struct regcache
*regcache
, int regnum
)
779 gdb_assert (regnum
>= 0);
780 gdb_assert (regnum
< regcache
->descr
->nr_cooked_registers
);
782 if (regnum
< regcache
->descr
->nr_raw_registers
783 || (regcache
->readonly_p
784 && regcache
->register_status
[regnum
] != REG_UNKNOWN
)
785 || !gdbarch_pseudo_register_read_value_p (regcache
->descr
->gdbarch
))
787 struct value
*result
;
789 result
= allocate_value (register_type (regcache
->descr
->gdbarch
,
791 VALUE_LVAL (result
) = lval_register
;
792 VALUE_REGNUM (result
) = regnum
;
794 /* It is more efficient in general to do this delegation in this
795 direction than in the other one, even though the value-based
797 if (regcache_cooked_read (regcache
, regnum
,
798 value_contents_raw (result
)) == REG_UNAVAILABLE
)
799 mark_value_bytes_unavailable (result
, 0,
800 TYPE_LENGTH (value_type (result
)));
805 return gdbarch_pseudo_register_read_value (regcache
->descr
->gdbarch
,
810 regcache_cooked_read_signed (struct regcache
*regcache
, int regnum
,
813 enum register_status status
;
816 gdb_assert (regcache
!= NULL
);
817 gdb_assert (regnum
>= 0 && regnum
< regcache
->descr
->nr_cooked_registers
);
818 buf
= alloca (regcache
->descr
->sizeof_register
[regnum
]);
819 status
= regcache_cooked_read (regcache
, regnum
, buf
);
820 if (status
== REG_VALID
)
821 *val
= extract_signed_integer
822 (buf
, regcache
->descr
->sizeof_register
[regnum
],
823 gdbarch_byte_order (regcache
->descr
->gdbarch
));
830 regcache_cooked_read_unsigned (struct regcache
*regcache
, int regnum
,
833 enum register_status status
;
836 gdb_assert (regcache
!= NULL
);
837 gdb_assert (regnum
>= 0 && regnum
< regcache
->descr
->nr_cooked_registers
);
838 buf
= alloca (regcache
->descr
->sizeof_register
[regnum
]);
839 status
= regcache_cooked_read (regcache
, regnum
, buf
);
840 if (status
== REG_VALID
)
841 *val
= extract_unsigned_integer
842 (buf
, regcache
->descr
->sizeof_register
[regnum
],
843 gdbarch_byte_order (regcache
->descr
->gdbarch
));
850 regcache_cooked_write_signed (struct regcache
*regcache
, int regnum
,
855 gdb_assert (regcache
!= NULL
);
856 gdb_assert (regnum
>=0 && regnum
< regcache
->descr
->nr_cooked_registers
);
857 buf
= alloca (regcache
->descr
->sizeof_register
[regnum
]);
858 store_signed_integer (buf
, regcache
->descr
->sizeof_register
[regnum
],
859 gdbarch_byte_order (regcache
->descr
->gdbarch
), val
);
860 regcache_cooked_write (regcache
, regnum
, buf
);
864 regcache_cooked_write_unsigned (struct regcache
*regcache
, int regnum
,
869 gdb_assert (regcache
!= NULL
);
870 gdb_assert (regnum
>=0 && regnum
< regcache
->descr
->nr_cooked_registers
);
871 buf
= alloca (regcache
->descr
->sizeof_register
[regnum
]);
872 store_unsigned_integer (buf
, regcache
->descr
->sizeof_register
[regnum
],
873 gdbarch_byte_order (regcache
->descr
->gdbarch
), val
);
874 regcache_cooked_write (regcache
, regnum
, buf
);
878 regcache_raw_write (struct regcache
*regcache
, int regnum
,
881 struct cleanup
*chain_before_save_inferior
;
882 struct cleanup
*chain_before_invalidate_register
;
884 gdb_assert (regcache
!= NULL
&& buf
!= NULL
);
885 gdb_assert (regnum
>= 0 && regnum
< regcache
->descr
->nr_raw_registers
);
886 gdb_assert (!regcache
->readonly_p
);
888 /* On the sparc, writing %g0 is a no-op, so we don't even want to
889 change the registers array if something writes to this register. */
890 if (gdbarch_cannot_store_register (get_regcache_arch (regcache
), regnum
))
893 /* If we have a valid copy of the register, and new value == old
894 value, then don't bother doing the actual store. */
895 if (regcache_register_status (regcache
, regnum
) == REG_VALID
896 && (memcmp (register_buffer (regcache
, regnum
), buf
,
897 regcache
->descr
->sizeof_register
[regnum
]) == 0))
900 chain_before_save_inferior
= save_inferior_ptid ();
901 inferior_ptid
= regcache
->ptid
;
903 target_prepare_to_store (regcache
);
904 memcpy (register_buffer (regcache
, regnum
), buf
,
905 regcache
->descr
->sizeof_register
[regnum
]);
906 regcache
->register_status
[regnum
] = REG_VALID
;
908 /* Register a cleanup function for invalidating the register after it is
909 written, in case of a failure. */
910 chain_before_invalidate_register
911 = make_cleanup_regcache_invalidate (regcache
, regnum
);
913 target_store_registers (regcache
, regnum
);
915 /* The target did not throw an error so we can discard invalidating the
916 register and restore the cleanup chain to what it was. */
917 discard_cleanups (chain_before_invalidate_register
);
919 do_cleanups (chain_before_save_inferior
);
923 regcache_cooked_write (struct regcache
*regcache
, int regnum
,
926 gdb_assert (regnum
>= 0);
927 gdb_assert (regnum
< regcache
->descr
->nr_cooked_registers
);
928 if (regnum
< regcache
->descr
->nr_raw_registers
)
929 regcache_raw_write (regcache
, regnum
, buf
);
931 gdbarch_pseudo_register_write (regcache
->descr
->gdbarch
, regcache
,
935 /* Perform a partial register transfer using a read, modify, write
938 typedef void (regcache_read_ftype
) (struct regcache
*regcache
, int regnum
,
940 typedef void (regcache_write_ftype
) (struct regcache
*regcache
, int regnum
,
943 static enum register_status
944 regcache_xfer_part (struct regcache
*regcache
, int regnum
,
945 int offset
, int len
, void *in
, const void *out
,
946 enum register_status (*read
) (struct regcache
*regcache
,
949 void (*write
) (struct regcache
*regcache
, int regnum
,
950 const gdb_byte
*buf
))
952 struct regcache_descr
*descr
= regcache
->descr
;
953 gdb_byte reg
[MAX_REGISTER_SIZE
];
955 gdb_assert (offset
>= 0 && offset
<= descr
->sizeof_register
[regnum
]);
956 gdb_assert (len
>= 0 && offset
+ len
<= descr
->sizeof_register
[regnum
]);
957 /* Something to do? */
958 if (offset
+ len
== 0)
960 /* Read (when needed) ... */
963 || offset
+ len
< descr
->sizeof_register
[regnum
])
965 enum register_status status
;
967 gdb_assert (read
!= NULL
);
968 status
= read (regcache
, regnum
, reg
);
969 if (status
!= REG_VALID
)
974 memcpy (in
, reg
+ offset
, len
);
976 memcpy (reg
+ offset
, out
, len
);
977 /* ... write (when needed). */
980 gdb_assert (write
!= NULL
);
981 write (regcache
, regnum
, reg
);
988 regcache_raw_read_part (struct regcache
*regcache
, int regnum
,
989 int offset
, int len
, gdb_byte
*buf
)
991 struct regcache_descr
*descr
= regcache
->descr
;
993 gdb_assert (regnum
>= 0 && regnum
< descr
->nr_raw_registers
);
994 return regcache_xfer_part (regcache
, regnum
, offset
, len
, buf
, NULL
,
995 regcache_raw_read
, regcache_raw_write
);
999 regcache_raw_write_part (struct regcache
*regcache
, int regnum
,
1000 int offset
, int len
, const gdb_byte
*buf
)
1002 struct regcache_descr
*descr
= regcache
->descr
;
1004 gdb_assert (regnum
>= 0 && regnum
< descr
->nr_raw_registers
);
1005 regcache_xfer_part (regcache
, regnum
, offset
, len
, NULL
, buf
,
1006 regcache_raw_read
, regcache_raw_write
);
1009 enum register_status
1010 regcache_cooked_read_part (struct regcache
*regcache
, int regnum
,
1011 int offset
, int len
, gdb_byte
*buf
)
1013 struct regcache_descr
*descr
= regcache
->descr
;
1015 gdb_assert (regnum
>= 0 && regnum
< descr
->nr_cooked_registers
);
1016 return regcache_xfer_part (regcache
, regnum
, offset
, len
, buf
, NULL
,
1017 regcache_cooked_read
, regcache_cooked_write
);
1021 regcache_cooked_write_part (struct regcache
*regcache
, int regnum
,
1022 int offset
, int len
, const gdb_byte
*buf
)
1024 struct regcache_descr
*descr
= regcache
->descr
;
1026 gdb_assert (regnum
>= 0 && regnum
< descr
->nr_cooked_registers
);
1027 regcache_xfer_part (regcache
, regnum
, offset
, len
, NULL
, buf
,
1028 regcache_cooked_read
, regcache_cooked_write
);
1031 /* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */
1034 regcache_raw_supply (struct regcache
*regcache
, int regnum
, const void *buf
)
1039 gdb_assert (regcache
!= NULL
);
1040 gdb_assert (regnum
>= 0 && regnum
< regcache
->descr
->nr_raw_registers
);
1041 gdb_assert (!regcache
->readonly_p
);
1043 regbuf
= register_buffer (regcache
, regnum
);
1044 size
= regcache
->descr
->sizeof_register
[regnum
];
1048 memcpy (regbuf
, buf
, size
);
1049 regcache
->register_status
[regnum
] = REG_VALID
;
1053 /* This memset not strictly necessary, but better than garbage
1054 in case the register value manages to escape somewhere (due
1055 to a bug, no less). */
1056 memset (regbuf
, 0, size
);
1057 regcache
->register_status
[regnum
] = REG_UNAVAILABLE
;
1061 /* Collect register REGNUM from REGCACHE and store its contents in BUF. */
1064 regcache_raw_collect (const struct regcache
*regcache
, int regnum
, void *buf
)
1069 gdb_assert (regcache
!= NULL
&& buf
!= NULL
);
1070 gdb_assert (regnum
>= 0 && regnum
< regcache
->descr
->nr_raw_registers
);
1072 regbuf
= register_buffer (regcache
, regnum
);
1073 size
= regcache
->descr
->sizeof_register
[regnum
];
1074 memcpy (buf
, regbuf
, size
);
1077 /* Transfer a single or all registers belonging to a certain register
1078 set to or from a buffer. This is the main worker function for
1079 regcache_supply_regset and regcache_collect_regset. */
1082 regcache_transfer_regset (const struct regset
*regset
,
1083 const struct regcache
*regcache
,
1084 struct regcache
*out_regcache
,
1085 int regnum
, const void *in_buf
,
1086 void *out_buf
, size_t size
)
1088 const struct regcache_map_entry
*map
;
1089 int offs
= 0, count
;
1091 for (map
= regset
->regmap
; (count
= map
->count
) != 0; map
++)
1093 int regno
= map
->regno
;
1094 int slot_size
= map
->size
;
1096 if (slot_size
== 0 && regno
!= REGCACHE_MAP_SKIP
)
1097 slot_size
= regcache
->descr
->sizeof_register
[regno
];
1099 if (regno
== REGCACHE_MAP_SKIP
1101 && (regnum
< regno
|| regnum
>= regno
+ count
)))
1102 offs
+= count
* slot_size
;
1104 else if (regnum
== -1)
1105 for (; count
--; regno
++, offs
+= slot_size
)
1107 if (offs
+ slot_size
> size
)
1111 regcache_raw_collect (regcache
, regno
,
1112 (gdb_byte
*) out_buf
+ offs
);
1114 regcache_raw_supply (out_regcache
, regno
, in_buf
1115 ? (const gdb_byte
*) in_buf
+ offs
1120 /* Transfer a single register and return. */
1121 offs
+= (regnum
- regno
) * slot_size
;
1122 if (offs
+ slot_size
> size
)
1126 regcache_raw_collect (regcache
, regnum
,
1127 (gdb_byte
*) out_buf
+ offs
);
1129 regcache_raw_supply (out_regcache
, regnum
, in_buf
1130 ? (const gdb_byte
*) in_buf
+ offs
1137 /* Supply register REGNUM from BUF to REGCACHE, using the register map
1138 in REGSET. If REGNUM is -1, do this for all registers in REGSET.
1139 If BUF is NULL, set the register(s) to "unavailable" status. */
1142 regcache_supply_regset (const struct regset
*regset
,
1143 struct regcache
*regcache
,
1144 int regnum
, const void *buf
, size_t size
)
1146 regcache_transfer_regset (regset
, regcache
, regcache
, regnum
,
1150 /* Collect register REGNUM from REGCACHE to BUF, using the register
1151 map in REGSET. If REGNUM is -1, do this for all registers in
1155 regcache_collect_regset (const struct regset
*regset
,
1156 const struct regcache
*regcache
,
1157 int regnum
, void *buf
, size_t size
)
1159 regcache_transfer_regset (regset
, regcache
, NULL
, regnum
,
1164 /* Special handling for register PC. */
1167 regcache_read_pc (struct regcache
*regcache
)
1169 struct gdbarch
*gdbarch
= get_regcache_arch (regcache
);
1173 if (gdbarch_read_pc_p (gdbarch
))
1174 pc_val
= gdbarch_read_pc (gdbarch
, regcache
);
1175 /* Else use per-frame method on get_current_frame. */
1176 else if (gdbarch_pc_regnum (gdbarch
) >= 0)
1180 if (regcache_cooked_read_unsigned (regcache
,
1181 gdbarch_pc_regnum (gdbarch
),
1182 &raw_val
) == REG_UNAVAILABLE
)
1183 throw_error (NOT_AVAILABLE_ERROR
, _("PC register is not available"));
1185 pc_val
= gdbarch_addr_bits_remove (gdbarch
, raw_val
);
1188 internal_error (__FILE__
, __LINE__
,
1189 _("regcache_read_pc: Unable to find PC"));
1194 regcache_write_pc (struct regcache
*regcache
, CORE_ADDR pc
)
1196 struct gdbarch
*gdbarch
= get_regcache_arch (regcache
);
1198 if (gdbarch_write_pc_p (gdbarch
))
1199 gdbarch_write_pc (gdbarch
, regcache
, pc
);
1200 else if (gdbarch_pc_regnum (gdbarch
) >= 0)
1201 regcache_cooked_write_unsigned (regcache
,
1202 gdbarch_pc_regnum (gdbarch
), pc
);
1204 internal_error (__FILE__
, __LINE__
,
1205 _("regcache_write_pc: Unable to update PC"));
1207 /* Writing the PC (for instance, from "load") invalidates the
1209 reinit_frame_cache ();
1214 reg_flush_command (char *command
, int from_tty
)
1216 /* Force-flush the register cache. */
1217 registers_changed ();
1219 printf_filtered (_("Register cache flushed.\n"));
1222 enum regcache_dump_what
1224 regcache_dump_none
, regcache_dump_raw
,
1225 regcache_dump_cooked
, regcache_dump_groups
,
1226 regcache_dump_remote
1230 regcache_dump (struct regcache
*regcache
, struct ui_file
*file
,
1231 enum regcache_dump_what what_to_dump
)
1233 struct cleanup
*cleanups
= make_cleanup (null_cleanup
, NULL
);
1234 struct gdbarch
*gdbarch
= regcache
->descr
->gdbarch
;
1236 int footnote_nr
= 0;
1237 int footnote_register_size
= 0;
1238 int footnote_register_offset
= 0;
1239 int footnote_register_type_name_null
= 0;
1240 long register_offset
= 0;
1241 gdb_byte buf
[MAX_REGISTER_SIZE
];
1244 fprintf_unfiltered (file
, "nr_raw_registers %d\n",
1245 regcache
->descr
->nr_raw_registers
);
1246 fprintf_unfiltered (file
, "nr_cooked_registers %d\n",
1247 regcache
->descr
->nr_cooked_registers
);
1248 fprintf_unfiltered (file
, "sizeof_raw_registers %ld\n",
1249 regcache
->descr
->sizeof_raw_registers
);
1250 fprintf_unfiltered (file
, "sizeof_raw_register_status %ld\n",
1251 regcache
->descr
->sizeof_raw_register_status
);
1252 fprintf_unfiltered (file
, "gdbarch_num_regs %d\n",
1253 gdbarch_num_regs (gdbarch
));
1254 fprintf_unfiltered (file
, "gdbarch_num_pseudo_regs %d\n",
1255 gdbarch_num_pseudo_regs (gdbarch
));
1258 gdb_assert (regcache
->descr
->nr_cooked_registers
1259 == (gdbarch_num_regs (gdbarch
)
1260 + gdbarch_num_pseudo_regs (gdbarch
)));
1262 for (regnum
= -1; regnum
< regcache
->descr
->nr_cooked_registers
; regnum
++)
1266 fprintf_unfiltered (file
, " %-10s", "Name");
1269 const char *p
= gdbarch_register_name (gdbarch
, regnum
);
1273 else if (p
[0] == '\0')
1275 fprintf_unfiltered (file
, " %-10s", p
);
1280 fprintf_unfiltered (file
, " %4s", "Nr");
1282 fprintf_unfiltered (file
, " %4d", regnum
);
1284 /* Relative number. */
1286 fprintf_unfiltered (file
, " %4s", "Rel");
1287 else if (regnum
< gdbarch_num_regs (gdbarch
))
1288 fprintf_unfiltered (file
, " %4d", regnum
);
1290 fprintf_unfiltered (file
, " %4d",
1291 (regnum
- gdbarch_num_regs (gdbarch
)));
1295 fprintf_unfiltered (file
, " %6s ", "Offset");
1298 fprintf_unfiltered (file
, " %6ld",
1299 regcache
->descr
->register_offset
[regnum
]);
1300 if (register_offset
!= regcache
->descr
->register_offset
[regnum
]
1302 && (regcache
->descr
->register_offset
[regnum
]
1303 != (regcache
->descr
->register_offset
[regnum
- 1]
1304 + regcache
->descr
->sizeof_register
[regnum
- 1])))
1307 if (!footnote_register_offset
)
1308 footnote_register_offset
= ++footnote_nr
;
1309 fprintf_unfiltered (file
, "*%d", footnote_register_offset
);
1312 fprintf_unfiltered (file
, " ");
1313 register_offset
= (regcache
->descr
->register_offset
[regnum
]
1314 + regcache
->descr
->sizeof_register
[regnum
]);
1319 fprintf_unfiltered (file
, " %5s ", "Size");
1321 fprintf_unfiltered (file
, " %5ld",
1322 regcache
->descr
->sizeof_register
[regnum
]);
1332 static const char blt
[] = "builtin_type";
1334 t
= TYPE_NAME (register_type (regcache
->descr
->gdbarch
, regnum
));
1339 if (!footnote_register_type_name_null
)
1340 footnote_register_type_name_null
= ++footnote_nr
;
1341 n
= xstrprintf ("*%d", footnote_register_type_name_null
);
1342 make_cleanup (xfree
, n
);
1345 /* Chop a leading builtin_type. */
1346 if (strncmp (t
, blt
, strlen (blt
)) == 0)
1349 fprintf_unfiltered (file
, " %-15s", t
);
1352 /* Leading space always present. */
1353 fprintf_unfiltered (file
, " ");
1356 if (what_to_dump
== regcache_dump_raw
)
1359 fprintf_unfiltered (file
, "Raw value");
1360 else if (regnum
>= regcache
->descr
->nr_raw_registers
)
1361 fprintf_unfiltered (file
, "<cooked>");
1362 else if (regcache_register_status (regcache
, regnum
) == REG_UNKNOWN
)
1363 fprintf_unfiltered (file
, "<invalid>");
1364 else if (regcache_register_status (regcache
, regnum
) == REG_UNAVAILABLE
)
1365 fprintf_unfiltered (file
, "<unavailable>");
1368 regcache_raw_read (regcache
, regnum
, buf
);
1369 print_hex_chars (file
, buf
,
1370 regcache
->descr
->sizeof_register
[regnum
],
1371 gdbarch_byte_order (gdbarch
));
1375 /* Value, cooked. */
1376 if (what_to_dump
== regcache_dump_cooked
)
1379 fprintf_unfiltered (file
, "Cooked value");
1382 enum register_status status
;
1384 status
= regcache_cooked_read (regcache
, regnum
, buf
);
1385 if (status
== REG_UNKNOWN
)
1386 fprintf_unfiltered (file
, "<invalid>");
1387 else if (status
== REG_UNAVAILABLE
)
1388 fprintf_unfiltered (file
, "<unavailable>");
1390 print_hex_chars (file
, buf
,
1391 regcache
->descr
->sizeof_register
[regnum
],
1392 gdbarch_byte_order (gdbarch
));
1396 /* Group members. */
1397 if (what_to_dump
== regcache_dump_groups
)
1400 fprintf_unfiltered (file
, "Groups");
1403 const char *sep
= "";
1404 struct reggroup
*group
;
1406 for (group
= reggroup_next (gdbarch
, NULL
);
1408 group
= reggroup_next (gdbarch
, group
))
1410 if (gdbarch_register_reggroup_p (gdbarch
, regnum
, group
))
1412 fprintf_unfiltered (file
,
1413 "%s%s", sep
, reggroup_name (group
));
1420 /* Remote packet configuration. */
1421 if (what_to_dump
== regcache_dump_remote
)
1425 fprintf_unfiltered (file
, "Rmt Nr g/G Offset");
1427 else if (regnum
< regcache
->descr
->nr_raw_registers
)
1431 if (remote_register_number_and_offset (get_regcache_arch (regcache
), regnum
,
1433 fprintf_unfiltered (file
, "%7d %11d", pnum
, poffset
);
1437 fprintf_unfiltered (file
, "\n");
1440 if (footnote_register_size
)
1441 fprintf_unfiltered (file
, "*%d: Inconsistent register sizes.\n",
1442 footnote_register_size
);
1443 if (footnote_register_offset
)
1444 fprintf_unfiltered (file
, "*%d: Inconsistent register offsets.\n",
1445 footnote_register_offset
);
1446 if (footnote_register_type_name_null
)
1447 fprintf_unfiltered (file
,
1448 "*%d: Register type's name NULL.\n",
1449 footnote_register_type_name_null
);
1450 do_cleanups (cleanups
);
1454 regcache_print (char *args
, enum regcache_dump_what what_to_dump
)
1457 regcache_dump (get_current_regcache (), gdb_stdout
, what_to_dump
);
1460 struct cleanup
*cleanups
;
1461 struct ui_file
*file
= gdb_fopen (args
, "w");
1464 perror_with_name (_("maintenance print architecture"));
1465 cleanups
= make_cleanup_ui_file_delete (file
);
1466 regcache_dump (get_current_regcache (), file
, what_to_dump
);
1467 do_cleanups (cleanups
);
1472 maintenance_print_registers (char *args
, int from_tty
)
1474 regcache_print (args
, regcache_dump_none
);
1478 maintenance_print_raw_registers (char *args
, int from_tty
)
1480 regcache_print (args
, regcache_dump_raw
);
1484 maintenance_print_cooked_registers (char *args
, int from_tty
)
1486 regcache_print (args
, regcache_dump_cooked
);
1490 maintenance_print_register_groups (char *args
, int from_tty
)
1492 regcache_print (args
, regcache_dump_groups
);
1496 maintenance_print_remote_registers (char *args
, int from_tty
)
1498 regcache_print (args
, regcache_dump_remote
);
1501 extern initialize_file_ftype _initialize_regcache
; /* -Wmissing-prototype */
1504 _initialize_regcache (void)
1506 regcache_descr_handle
1507 = gdbarch_data_register_post_init (init_regcache_descr
);
1509 observer_attach_target_changed (regcache_observer_target_changed
);
1510 observer_attach_thread_ptid_changed (regcache_thread_ptid_changed
);
1512 add_com ("flushregs", class_maintenance
, reg_flush_command
,
1513 _("Force gdb to flush its register cache (maintainer command)"));
1515 add_cmd ("registers", class_maintenance
, maintenance_print_registers
,
1516 _("Print the internal register configuration.\n"
1517 "Takes an optional file parameter."), &maintenanceprintlist
);
1518 add_cmd ("raw-registers", class_maintenance
,
1519 maintenance_print_raw_registers
,
1520 _("Print the internal register configuration "
1521 "including raw values.\n"
1522 "Takes an optional file parameter."), &maintenanceprintlist
);
1523 add_cmd ("cooked-registers", class_maintenance
,
1524 maintenance_print_cooked_registers
,
1525 _("Print the internal register configuration "
1526 "including cooked values.\n"
1527 "Takes an optional file parameter."), &maintenanceprintlist
);
1528 add_cmd ("register-groups", class_maintenance
,
1529 maintenance_print_register_groups
,
1530 _("Print the internal register configuration "
1531 "including each register's group.\n"
1532 "Takes an optional file parameter."),
1533 &maintenanceprintlist
);
1534 add_cmd ("remote-registers", class_maintenance
,
1535 maintenance_print_remote_registers
, _("\
1536 Print the internal register configuration including each register's\n\
1537 remote register number and buffer offset in the g/G packets.\n\
1538 Takes an optional file parameter."),
1539 &maintenanceprintlist
);