Use struct bfd_seclet * rather than bfd_seclet_type in prototypes to
[deliverable/binutils-gdb.git] / gdb / valprint.c
CommitLineData
7d9884b9
JG
1/* Print values for GDB, the GNU debugger.
2 Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
bd5635a1
RP
3
4This file is part of GDB.
5
36b9d39c 6This program is free software; you can redistribute it and/or modify
bd5635a1 7it under the terms of the GNU General Public License as published by
36b9d39c
JG
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
bd5635a1 10
36b9d39c 11This program is distributed in the hope that it will be useful,
bd5635a1
RP
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
36b9d39c
JG
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
bd5635a1 19
bd5635a1 20#include "defs.h"
2cd99985 21#include <string.h>
bd5635a1 22#include "symtab.h"
2cd99985 23#include "gdbtypes.h"
bd5635a1
RP
24#include "value.h"
25#include "gdbcore.h"
26#include "gdbcmd.h"
27#include "target.h"
28#include "obstack.h"
be3bc7ad 29#include "language.h"
8f793aa5 30#include "demangle.h"
bd5635a1
RP
31
32#include <errno.h>
2cd99985
PB
33
34/* Prototypes for local functions */
35
a8a69e63
FF
36static void
37print_hex_chars PARAMS ((FILE *, unsigned char *, unsigned int));
38
2cd99985
PB
39static void
40show_print PARAMS ((char *, int));
41
42static void
43set_print PARAMS ((char *, int));
44
45static void
46set_radix PARAMS ((char *, int, struct cmd_list_element *));
47
48static void
49set_output_radix PARAMS ((char *, int, struct cmd_list_element *));
50
51static void
a8a69e63 52value_print_array_elements PARAMS ((value, FILE *, int, enum val_prettyprint));
bd5635a1
RP
53
54/* Maximum number of chars to print for a string pointer value
55 or vector contents, or UINT_MAX for no limit. */
56
85f0a848 57unsigned int print_max;
bd5635a1 58
bd5635a1
RP
59/* Default input and output radixes, and output format letter. */
60
61unsigned input_radix = 10;
62unsigned output_radix = 10;
63int output_format = 0;
64
85f0a848
FF
65/* Print repeat counts if there are more than this many repetitions of an
66 element in an array. Referenced by the low level language dependent
67 print routines. */
68
69unsigned int repeat_count_threshold = 10;
0dce3774 70
a8a69e63
FF
71int prettyprint_structs; /* Controls pretty printing of structures */
72int prettyprint_arrays; /* Controls pretty printing of arrays. */
0dce3774 73
a8a69e63
FF
74/* If nonzero, causes unions inside structures or other unions to be
75 printed. */
bd5635a1 76
a8a69e63 77int unionprint; /* Controls printing of nested unions. */
bd5635a1 78
a8a69e63 79/* If nonzero, causes machine addresses to be printed in certain contexts. */
bd5635a1 80
a8a69e63 81int addressprint; /* Controls printing of machine addresses */
bd5635a1 82
a8a69e63
FF
83\f
84/* Print data of type TYPE located at VALADDR (within GDB),
85 which came from the inferior at address ADDRESS,
86 onto stdio stream STREAM according to FORMAT
87 (a letter or 0 for natural format). The data at VALADDR
88 is in target byte order.
bd5635a1 89
a8a69e63
FF
90 If the data are a string pointer, returns the number of
91 sting characters printed.
bd5635a1 92
a8a69e63
FF
93 if DEREF_REF is nonzero, then dereference references,
94 otherwise just print them like pointers.
bd5635a1 95
a8a69e63 96 The PRETTY parameter controls prettyprinting. */
bd5635a1 97
a8a69e63
FF
98int
99val_print (type, valaddr, address, stream, format, deref_ref, recurse,
100 pretty)
101 struct type *type;
102 char *valaddr;
103 CORE_ADDR address;
bd5635a1 104 FILE *stream;
a8a69e63
FF
105 int format;
106 int deref_ref;
107 int recurse;
108 enum val_prettyprint pretty;
bd5635a1 109{
a8a69e63
FF
110 if (pretty == Val_pretty_default)
111 {
112 pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
113 }
bd5635a1 114
a8a69e63
FF
115 QUIT;
116
117 /* Ensure that the type is complete and not just a stub. If the type is
118 only a stub and we can't find and substitute its complete type, then
119 print appropriate string and return. Typical types that my be stubs
120 are structs, unions, and C++ methods. */
121
122 check_stub_type (type);
123 if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
bd5635a1 124 {
a8a69e63
FF
125 fprintf_filtered (stream, "<incomplete type>");
126 fflush (stream);
127 return (0);
bd5635a1 128 }
a8a69e63
FF
129
130 return (LA_VAL_PRINT (type, valaddr, address, stream, format, deref_ref,
131 recurse, pretty));
bd5635a1 132}
a8a69e63 133
bd5635a1
RP
134/* Print the value VAL in C-ish syntax on stream STREAM.
135 FORMAT is a format-letter, or 0 for print in natural format of data type.
136 If the object printed is a string pointer, returns
137 the number of string bytes printed. */
138
139int
140value_print (val, stream, format, pretty)
141 value val;
142 FILE *stream;
2cd99985 143 int format;
bd5635a1
RP
144 enum val_prettyprint pretty;
145{
a8a69e63 146 register unsigned int n, typelen;
bd5635a1
RP
147
148 if (val == 0)
149 {
150 printf_filtered ("<address of value unknown>");
151 return 0;
152 }
153 if (VALUE_OPTIMIZED_OUT (val))
154 {
155 printf_filtered ("<value optimized out>");
156 return 0;
157 }
aec4cb91 158
bd5635a1
RP
159 /* A "repeated" value really contains several values in a row.
160 They are made by the @ operator.
161 Print such values as if they were arrays. */
162
a8a69e63 163 if (VALUE_REPEATED (val))
bd5635a1
RP
164 {
165 n = VALUE_REPETITIONS (val);
166 typelen = TYPE_LENGTH (VALUE_TYPE (val));
167 fprintf_filtered (stream, "{");
168 /* Print arrays of characters using string syntax. */
169 if (typelen == 1 && TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT
170 && format == 0)
a8a69e63 171 LA_PRINT_STRING (stream, VALUE_CONTENTS (val), n, 0);
bd5635a1
RP
172 else
173 {
a8a69e63 174 value_print_array_elements (val, stream, format, pretty);
bd5635a1
RP
175 }
176 fprintf_filtered (stream, "}");
a8a69e63 177 return (n * typelen);
bd5635a1
RP
178 }
179 else
180 {
0dce3774
JK
181 struct type *type = VALUE_TYPE (val);
182
bd5635a1
RP
183 /* If it is a pointer, indicate what it points to.
184
185 Print type also if it is a reference.
186
187 C++: if it is a member pointer, we will take care
188 of that when we print it. */
a8a69e63
FF
189 if (TYPE_CODE (type) == TYPE_CODE_PTR ||
190 TYPE_CODE (type) == TYPE_CODE_REF)
bd5635a1
RP
191 {
192 /* Hack: remove (char *) for char strings. Their
193 type is indicated by the quoted string anyway. */
a8a69e63
FF
194 if (TYPE_CODE (type) == TYPE_CODE_PTR &&
195 TYPE_LENGTH (TYPE_TARGET_TYPE (type)) == sizeof(char) &&
196 TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_INT &&
197 !TYPE_UNSIGNED (TYPE_TARGET_TYPE (type)))
bd5635a1
RP
198 {
199 /* Print nothing */
200 }
a8a69e63
FF
201 else
202 {
203 fprintf_filtered (stream, "(");
204 type_print (type, "", stream, -1);
205 fprintf_filtered (stream, ") ");
206 }
207 }
208 return (val_print (type, VALUE_CONTENTS (val),
209 VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
bd5635a1
RP
210 }
211}
212
a8a69e63
FF
213/* Called by various <lang>_val_print routines to print TYPE_CODE_INT's */
214
215void
216val_print_type_code_int (type, valaddr, stream)
9e4667f6 217 struct type *type;
a8a69e63 218 char *valaddr;
9e4667f6
FF
219 FILE *stream;
220{
a8a69e63
FF
221 char *p;
222 /* Pointer to first (i.e. lowest address) nonzero character. */
223 char *first_addr;
224 unsigned int len;
9e4667f6 225
a8a69e63 226 if (TYPE_LENGTH (type) > sizeof (LONGEST))
9e4667f6 227 {
a8a69e63 228 if (TYPE_UNSIGNED (type))
9e4667f6 229 {
a8a69e63
FF
230 /* First figure out whether the number in fact has zeros
231 in all its bytes more significant than least significant
232 sizeof (LONGEST) ones. */
233 len = TYPE_LENGTH (type);
234
235#if TARGET_BYTE_ORDER == BIG_ENDIAN
236 for (p = valaddr;
237 len > sizeof (LONGEST) && p < valaddr + TYPE_LENGTH (type);
238 p++)
239#else /* Little endian. */
240 first_addr = valaddr;
241 for (p = valaddr + TYPE_LENGTH (type);
242 len > sizeof (LONGEST) && p >= valaddr;
243 p--)
244#endif /* Little endian. */
9e4667f6 245 {
a8a69e63 246 if (*p == 0)
9e4667f6 247 {
a8a69e63 248 len--;
9e4667f6 249 }
a8a69e63 250 else
9e4667f6 251 {
a8a69e63 252 break;
9e4667f6
FF
253 }
254 }
a8a69e63
FF
255#if TARGET_BYTE_ORDER == BIG_ENDIAN
256 first_addr = p;
257#endif
258 if (len <= sizeof (LONGEST))
259 {
260 /* We can print it in decimal. */
261 fprintf_filtered
262 (stream,
263#if defined (LONG_LONG)
264 "%llu",
265#else
266 "%lu",
267#endif
268 unpack_long (BUILTIN_TYPE_LONGEST, first_addr));
269 }
270 else
271 {
272 /* It is big, so print it in hex. */
273 print_hex_chars (stream, (unsigned char *) first_addr, len);
274 }
275 }
276 else
277 {
278 /* Signed. One could assume two's complement (a reasonable
279 assumption, I think) and do better than this. */
280 print_hex_chars (stream, (unsigned char *) valaddr,
281 TYPE_LENGTH (type));
9e4667f6
FF
282 }
283 }
a8a69e63
FF
284 else
285 {
286#ifdef PRINT_TYPELESS_INTEGER
287 PRINT_TYPELESS_INTEGER (stream, type, unpack_long (type, valaddr));
288#else
289 fprintf_filtered (stream, TYPE_UNSIGNED (type) ?
290#if defined (LONG_LONG)
291 "%llu" : "%lld",
292#else
293 "%u" : "%d",
294#endif
295 unpack_long (type, valaddr));
296#endif
297 }
298}
9e4667f6 299
a8a69e63
FF
300/* Print a floating point value of type TYPE, pointed to in GDB by VALADDR,
301 on STREAM. */
bd5635a1 302
a8a69e63
FF
303void
304print_floating (valaddr, type, stream)
305 char *valaddr;
bd5635a1
RP
306 struct type *type;
307 FILE *stream;
bd5635a1 308{
a8a69e63
FF
309 double doub;
310 int inv;
311 unsigned len = TYPE_LENGTH (type);
312
313#if defined (IEEE_FLOAT)
bd5635a1 314
a8a69e63
FF
315 /* Check for NaN's. Note that this code does not depend on us being
316 on an IEEE conforming system. It only depends on the target
317 machine using IEEE representation. This means (a)
318 cross-debugging works right, and (2) IEEE_FLOAT can (and should)
319 be defined for systems like the 68881, which uses IEEE
320 representation, but is not IEEE conforming. */
bd5635a1 321
a8a69e63
FF
322 {
323 long low, high;
324 /* Is the sign bit 0? */
325 int nonnegative;
326 /* Is it is a NaN (i.e. the exponent is all ones and
327 the fraction is nonzero)? */
328 int is_nan;
bd5635a1 329
a8a69e63
FF
330 if (len == sizeof (float))
331 {
332 /* It's single precision. */
333 memcpy ((char *) &low, valaddr, sizeof (low));
334 /* target -> host. */
335 SWAP_TARGET_AND_HOST (&low, sizeof (float));
336 nonnegative = low >= 0;
337 is_nan = ((((low >> 23) & 0xFF) == 0xFF)
338 && 0 != (low & 0x7FFFFF));
339 low &= 0x7fffff;
340 high = 0;
341 }
342 else
343 {
344 /* It's double precision. Get the high and low words. */
bd5635a1 345
a8a69e63
FF
346#if TARGET_BYTE_ORDER == BIG_ENDIAN
347 memcpy (&low, valaddr+4, sizeof (low));
348 memcpy (&high, valaddr+0, sizeof (high));
349#else
350 memcpy (&low, valaddr+0, sizeof (low));
351 memcpy (&high, valaddr+4, sizeof (high));
352#endif
353 SWAP_TARGET_AND_HOST (&low, sizeof (low));
354 SWAP_TARGET_AND_HOST (&high, sizeof (high));
355 nonnegative = high >= 0;
356 is_nan = (((high >> 20) & 0x7ff) == 0x7ff
357 && ! ((((high & 0xfffff) == 0)) && (low == 0)));
358 high &= 0xfffff;
359 }
bd5635a1 360
a8a69e63
FF
361 if (is_nan)
362 {
363 /* The meaning of the sign and fraction is not defined by IEEE.
364 But the user might know what they mean. For example, they
365 (in an implementation-defined manner) distinguish between
366 signaling and quiet NaN's. */
367 if (high)
368 fprintf_filtered (stream, "-NaN(0x%lx%.8lx)" + nonnegative,
369 high, low);
370 else
371 fprintf_filtered (stream, "-NaN(0x%lx)" + nonnegative, low);
372 return;
373 }
374 }
375#endif /* IEEE_FLOAT. */
bd5635a1 376
a8a69e63
FF
377 doub = unpack_double (type, valaddr, &inv);
378 if (inv)
379 fprintf_filtered (stream, "<invalid float value>");
380 else
381 fprintf_filtered (stream, len <= sizeof(float) ? "%.9g" : "%.17g", doub);
bd5635a1
RP
382}
383
a8a69e63 384/* VALADDR points to an integer of LEN bytes. Print it in hex on stream. */
bd5635a1
RP
385
386static void
a8a69e63 387print_hex_chars (stream, valaddr, len)
bd5635a1 388 FILE *stream;
a8a69e63
FF
389 unsigned char *valaddr;
390 unsigned len;
bd5635a1 391{
a8a69e63
FF
392 unsigned char *p;
393
394 fprintf_filtered (stream, "0x");
395#if TARGET_BYTE_ORDER == BIG_ENDIAN
396 for (p = valaddr;
397 p < valaddr + len;
398 p++)
399#else /* Little endian. */
400 for (p = valaddr + len - 1;
401 p >= valaddr;
402 p--)
403#endif
bd5635a1 404 {
a8a69e63 405 fprintf_filtered (stream, "%02x", *p);
bd5635a1 406 }
a8a69e63 407}
bd5635a1 408
a8a69e63
FF
409/* Called by various <lang>_val_print routines to print elements of an
410 array in the form "<elem1>, <elem2>, <elem3>, ...".
4a11eef2 411
a8a69e63
FF
412 (FIXME?) Assumes array element separator is a comma, which is correct
413 for all languages currently handled.
414 (FIXME?) Some languages have a notation for repeated array elements,
415 perhaps we should try to use that notation when appropriate.
416 */
bd5635a1 417
a8a69e63
FF
418void
419val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
420 recurse, pretty, i)
421 struct type *type;
422 char *valaddr;
423 CORE_ADDR address;
424 FILE *stream;
425 int format;
426 int deref_ref;
427 int recurse;
428 enum val_prettyprint pretty;
429 unsigned int i;
430{
431 unsigned int things_printed = 0;
432 unsigned len;
433 struct type *elttype;
434 unsigned eltlen;
435 /* Position of the array element we are examining to see
436 whether it is repeated. */
437 unsigned int rep1;
438 /* Number of repetitions we have detected so far. */
439 unsigned int reps;
440
441 elttype = TYPE_TARGET_TYPE (type);
442 eltlen = TYPE_LENGTH (elttype);
443 len = TYPE_LENGTH (type) / eltlen;
444
445 for (; i < len && things_printed < print_max; i++)
bd5635a1 446 {
a8a69e63 447 if (i != 0)
bd5635a1 448 {
a8a69e63 449 if (prettyprint_arrays)
bd5635a1 450 {
a8a69e63
FF
451 fprintf_filtered (stream, ",\n");
452 print_spaces_filtered (2 + 2 * recurse, stream);
bd5635a1 453 }
a8a69e63 454 else
bd5635a1 455 {
a8a69e63 456 fprintf_filtered (stream, ", ");
bd5635a1 457 }
bd5635a1 458 }
a8a69e63
FF
459 wrap_here (n_spaces (2 + 2 * recurse));
460
461 rep1 = i + 1;
462 reps = 1;
463 while ((rep1 < len) &&
464 !memcmp (valaddr + i * eltlen, valaddr + rep1 * eltlen, eltlen))
465 {
466 ++reps;
467 ++rep1;
468 }
469
470 if (reps > repeat_count_threshold)
bd5635a1 471 {
a8a69e63
FF
472 val_print (elttype, valaddr + i * eltlen, 0, stream, format,
473 deref_ref, recurse + 1, pretty);
474 fprintf_filtered (stream, " <repeats %u times>", reps);
475 i = rep1 - 1;
476 things_printed += repeat_count_threshold;
bd5635a1 477 }
bd5635a1
RP
478 else
479 {
a8a69e63
FF
480 val_print (elttype, valaddr + i * eltlen, 0, stream, format,
481 deref_ref, recurse + 1, pretty);
482 things_printed++;
bd5635a1 483 }
a8a69e63
FF
484 }
485 if (i < len)
486 {
487 fprintf_filtered (stream, "...");
488 }
489}
e2aab031 490
a8a69e63
FF
491static void
492value_print_array_elements (val, stream, format, pretty)
493 value val;
494 FILE *stream;
495 int format;
496 enum val_prettyprint pretty;
497{
498 unsigned int things_printed = 0;
499 register unsigned int i, n, typelen;
500 /* Position of the array elem we are examining to see if it is repeated. */
501 unsigned int rep1;
502 /* Number of repetitions we have detected so far. */
503 unsigned int reps;
504
505 n = VALUE_REPETITIONS (val);
506 typelen = TYPE_LENGTH (VALUE_TYPE (val));
507 for (i = 0; i < n && things_printed < print_max; i++)
508 {
509 if (i != 0)
510 {
511 fprintf_filtered (stream, ", ");
512 }
513 wrap_here ("");
514
515 rep1 = i + 1;
516 reps = 1;
517 while (rep1 < n && !memcmp (VALUE_CONTENTS (val) + typelen * i,
518 VALUE_CONTENTS (val) + typelen * rep1,
519 typelen))
520 {
521 ++reps;
522 ++rep1;
523 }
524
525 if (reps > repeat_count_threshold)
4ace50a5 526 {
a8a69e63
FF
527 val_print (VALUE_TYPE (val), VALUE_CONTENTS (val) + typelen * i,
528 VALUE_ADDRESS (val) + typelen * i, stream, format, 1,
529 0, pretty);
530 fprintf (stream, " <repeats %u times>", reps);
531 i = rep1 - 1;
532 things_printed += repeat_count_threshold;
4ace50a5
FF
533 }
534 else
535 {
a8a69e63
FF
536 val_print (VALUE_TYPE (val), VALUE_CONTENTS (val) + typelen * i,
537 VALUE_ADDRESS (val) + typelen * i, stream, format, 1,
538 0, pretty);
539 things_printed++;
4ace50a5 540 }
a8a69e63
FF
541 }
542 if (i < n)
543 {
544 fprintf_filtered (stream, "...");
bd5635a1
RP
545 }
546}
a8a69e63 547
bd5635a1 548\f
e1ce8aa5 549#if 0
bd5635a1
RP
550/* Validate an input or output radix setting, and make sure the user
551 knows what they really did here. Radix setting is confusing, e.g.
552 setting the input radix to "10" never changes it! */
553
e1ce8aa5 554/* ARGSUSED */
bd5635a1
RP
555static void
556set_input_radix (args, from_tty, c)
557 char *args;
558 int from_tty;
559 struct cmd_list_element *c;
560{
561 unsigned radix = *(unsigned *)c->var;
562
563 if (from_tty)
564 printf_filtered ("Input radix set to decimal %d, hex %x, octal %o\n",
565 radix, radix, radix);
566}
e1ce8aa5 567#endif
bd5635a1 568
e1ce8aa5 569/* ARGSUSED */
bd5635a1
RP
570static void
571set_output_radix (args, from_tty, c)
572 char *args;
573 int from_tty;
574 struct cmd_list_element *c;
575{
576 unsigned radix = *(unsigned *)c->var;
577
578 if (from_tty)
579 printf_filtered ("Output radix set to decimal %d, hex %x, octal %o\n",
580 radix, radix, radix);
581
582 /* FIXME, we really should be able to validate the setting BEFORE
583 it takes effect. */
584 switch (radix)
585 {
586 case 16:
587 output_format = 'x';
588 break;
589 case 10:
590 output_format = 0;
591 break;
592 case 8:
593 output_format = 'o'; /* octal */
594 break;
595 default:
596 output_format = 0;
597 error ("Unsupported radix ``decimal %d''; using decimal output",
598 radix);
599 }
600}
601
602/* Both at once */
603static void
604set_radix (arg, from_tty, c)
605 char *arg;
606 int from_tty;
607 struct cmd_list_element *c;
608{
609 unsigned radix = *(unsigned *)c->var;
610
611 if (from_tty)
612 printf_filtered ("Radix set to decimal %d, hex %x, octal %o\n",
613 radix, radix, radix);
614
615 input_radix = radix;
616 output_radix = radix;
617
618 set_output_radix (arg, 0, c);
619}
620\f
f266e564
JK
621/*ARGSUSED*/
622static void
623set_print (arg, from_tty)
624 char *arg;
625 int from_tty;
626{
627 printf (
628"\"set print\" must be followed by the name of a print subcommand.\n");
629 help_list (setprintlist, "set print ", -1, stdout);
630}
631
632/*ARGSUSED*/
633static void
634show_print (args, from_tty)
635 char *args;
636 int from_tty;
637{
638 cmd_show_list (showprintlist, from_tty, "");
639}
640\f
bd5635a1
RP
641void
642_initialize_valprint ()
643{
644 struct cmd_list_element *c;
645
f266e564
JK
646 add_prefix_cmd ("print", no_class, set_print,
647 "Generic command for setting how things print.",
648 &setprintlist, "set print ", 0, &setlist);
36b9d39c
JG
649 add_alias_cmd ("p", "print", no_class, 1, &setlist);
650 add_alias_cmd ("pr", "print", no_class, 1, &setlist); /* prefer set print
651 to set prompt */
f266e564
JK
652 add_prefix_cmd ("print", no_class, show_print,
653 "Generic command for showing print settings.",
654 &showprintlist, "show print ", 0, &showlist);
36b9d39c
JG
655 add_alias_cmd ("p", "print", no_class, 1, &showlist);
656 add_alias_cmd ("pr", "print", no_class, 1, &showlist);
f266e564 657
bd5635a1 658 add_show_from_set
f266e564 659 (add_set_cmd ("elements", no_class, var_uinteger, (char *)&print_max,
bd5635a1 660 "Set limit on string chars or array elements to print.\n\
f266e564
JK
661\"set print elements 0\" causes there to be no limit.",
662 &setprintlist),
663 &showprintlist);
bd5635a1 664
85f0a848
FF
665 add_show_from_set
666 (add_set_cmd ("repeats", no_class, var_uinteger,
667 (char *)&repeat_count_threshold,
668 "Set threshold for repeated print elements.\n\
669\"set print repeats 0\" causes all elements to be individually printed.",
670 &setprintlist),
671 &showprintlist);
672
bd5635a1 673 add_show_from_set
a8a69e63
FF
674 (add_set_cmd ("pretty", class_support, var_boolean,
675 (char *)&prettyprint_structs,
bd5635a1 676 "Set prettyprinting of structures.",
f266e564
JK
677 &setprintlist),
678 &showprintlist);
bd5635a1
RP
679
680 add_show_from_set
f266e564 681 (add_set_cmd ("union", class_support, var_boolean, (char *)&unionprint,
bd5635a1 682 "Set printing of unions interior to structures.",
f266e564
JK
683 &setprintlist),
684 &showprintlist);
bd5635a1
RP
685
686 add_show_from_set
a8a69e63
FF
687 (add_set_cmd ("array", class_support, var_boolean,
688 (char *)&prettyprint_arrays,
bd5635a1 689 "Set prettyprinting of arrays.",
f266e564
JK
690 &setprintlist),
691 &showprintlist);
bd5635a1
RP
692
693 add_show_from_set
f266e564 694 (add_set_cmd ("address", class_support, var_boolean, (char *)&addressprint,
bd5635a1 695 "Set printing of addresses.",
f266e564
JK
696 &setprintlist),
697 &showprintlist);
bd5635a1
RP
698
699#if 0
700 /* The "show radix" cmd isn't good enough to show two separate values.
701 The rest of the code works, but the show part is confusing, so don't
702 let them be set separately 'til we work out "show". */
703 c = add_set_cmd ("input-radix", class_support, var_uinteger,
704 (char *)&input_radix,
705 "Set default input radix for entering numbers.",
706 &setlist);
707 add_show_from_set (c, &showlist);
708 c->function = set_input_radix;
709
710 c = add_set_cmd ("output-radix", class_support, var_uinteger,
711 (char *)&output_radix,
712 "Set default output radix for printing of values.",
713 &setlist);
714 add_show_from_set (c, &showlist);
715 c->function = set_output_radix;
716#endif
717
718 c = add_set_cmd ("radix", class_support, var_uinteger,
719 (char *)&output_radix,
720 "Set default input and output number radix.",
721 &setlist);
722 add_show_from_set (c, &showlist);
2cd99985 723 c->function.sfunc = set_radix;
bd5635a1
RP
724
725 /* Give people the defaults which they are used to. */
a8a69e63
FF
726 prettyprint_structs = 0;
727 prettyprint_arrays = 0;
bd5635a1 728 unionprint = 1;
bd5635a1 729 addressprint = 1;
bd5635a1 730 print_max = 200;
bd5635a1 731}
This page took 0.130026 seconds and 4 git commands to generate.