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