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