home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / printcmd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-12  |  53.2 KB  |  2,069 lines

  1. /* Print values for GNU debugger GDB.
  2.    Copyright 1986, 1987, 1988, 1989, 1990, 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 "frame.h"
  23. #include "symtab.h"
  24. #include "gdbtypes.h"
  25. #include "value.h"
  26. #include "language.h"
  27. #include "expression.h"
  28. #include "gdbcore.h"
  29. #include "gdbcmd.h"
  30. #include "target.h"
  31. #include "breakpoint.h"
  32. #include "demangle.h"
  33.  
  34. /* These are just for containing_function_bounds.  It might be better
  35.    to move containing_function_bounds to blockframe.c or thereabouts.  */
  36. #include "bfd.h"
  37. #include "symfile.h"
  38. #include "objfiles.h"
  39.  
  40. extern int asm_demangle;    /* Whether to demangle syms in asm printouts */
  41. extern int addressprint;    /* Whether to print hex addresses in HLL " */
  42.  
  43. struct format_data
  44. {
  45.   int count;
  46.   char format;
  47.   char size;
  48. };
  49.  
  50. /* Last specified output format.  */
  51.  
  52. static char last_format = 'x';
  53.  
  54. /* Last specified examination size.  'b', 'h', 'w' or `q'.  */
  55.  
  56. static char last_size = 'w';
  57.  
  58. /* Default address to examine next.  */
  59.  
  60. static CORE_ADDR next_address;
  61.  
  62. /* Last address examined.  */
  63.  
  64. static CORE_ADDR last_examine_address;
  65.  
  66. /* Contents of last address examined.
  67.    This is not valid past the end of the `x' command!  */
  68.  
  69. static value last_examine_value;
  70.  
  71. /* Largest offset between a symbolic value and an address, that will be
  72.    printed as `0x1234 <symbol+offset>'.  */
  73.  
  74. static unsigned int max_symbolic_offset = UINT_MAX;
  75.  
  76. /* Number of auto-display expression currently being displayed.
  77.    So that we can disable it if we get an error or a signal within it.
  78.    -1 when not doing one.  */
  79.  
  80. int current_display_number;
  81.  
  82. /* Flag to low-level print routines that this value is being printed
  83.    in an epoch window.  We'd like to pass this as a parameter, but
  84.    every routine would need to take it.  Perhaps we can encapsulate
  85.    this in the I/O stream once we have GNU stdio. */
  86.  
  87. int inspect_it = 0;
  88.  
  89. struct display
  90. {
  91.   /* Chain link to next auto-display item.  */
  92.   struct display *next;
  93.   /* Expression to be evaluated and displayed.  */
  94.   struct expression *exp;
  95.   /* Item number of this auto-display item.  */
  96.   int number;
  97.   /* Display format specified.  */
  98.   struct format_data format;
  99.   /* Innermost block required by this expression when evaluated */
  100.   struct block *block;
  101.   /* Status of this display (enabled or disabled) */
  102.   enum enable status;
  103. };
  104.  
  105. /* Chain of expressions whose values should be displayed
  106.    automatically each time the program stops.  */
  107.  
  108. static struct display *display_chain;
  109.  
  110. static int display_number;
  111.  
  112. /* Prototypes for local functions */
  113.  
  114. static void
  115. delete_display PARAMS ((int));
  116.  
  117. static void
  118. enable_display PARAMS ((char *, int));
  119.  
  120. static void
  121. disable_display_command PARAMS ((char *, int));
  122.  
  123. static void
  124. disassemble_command PARAMS ((char *, int));
  125.  
  126. static int
  127. containing_function_bounds PARAMS ((CORE_ADDR, CORE_ADDR *, CORE_ADDR *));
  128.  
  129. static void
  130. printf_command PARAMS ((char *, int));
  131.  
  132. static void
  133. print_frame_nameless_args PARAMS ((struct frame_info *, long, int, int,
  134.                    FILE *));
  135.  
  136. static void
  137. display_info PARAMS ((char *, int));
  138.  
  139. static void
  140. do_one_display PARAMS ((struct display *));
  141.  
  142. static void
  143. undisplay_command PARAMS ((char *, int));
  144.  
  145. static void
  146. free_display PARAMS ((struct display *));
  147.  
  148. static void
  149. display_command PARAMS ((char *, int));
  150.  
  151. static void
  152. x_command PARAMS ((char *, int));
  153.  
  154. static void
  155. address_info PARAMS ((char *, int));
  156.  
  157. static void
  158. set_command PARAMS ((char *, int));
  159.  
  160. static void
  161. output_command PARAMS ((char *, int));
  162.  
  163. static void
  164. call_command PARAMS ((char *, int));
  165.  
  166. static void
  167. inspect_command PARAMS ((char *, int));
  168.  
  169. static void
  170. print_command PARAMS ((char *, int));
  171.  
  172. static void
  173. print_command_1 PARAMS ((char *, int, int));
  174.  
  175. static void
  176. validate_format PARAMS ((struct format_data, char *));
  177.  
  178. static void
  179. do_examine PARAMS ((struct format_data, CORE_ADDR));
  180.  
  181. static void
  182. print_formatted PARAMS ((value, int, int));
  183.  
  184. static struct format_data
  185. decode_format PARAMS ((char **, int, int));
  186.  
  187.  
  188. /* Decode a format specification.  *STRING_PTR should point to it.
  189.    OFORMAT and OSIZE are used as defaults for the format and size
  190.    if none are given in the format specification.
  191.    If OSIZE is zero, then the size field of the returned value
  192.    should be set only if a size is explicitly specified by the
  193.    user.
  194.    The structure returned describes all the data
  195.    found in the specification.  In addition, *STRING_PTR is advanced
  196.    past the specification and past all whitespace following it.  */
  197.  
  198. static struct format_data
  199. decode_format (string_ptr, oformat, osize)
  200.      char **string_ptr;
  201.      int oformat;
  202.      int osize;
  203. {
  204.   struct format_data val;
  205.   register char *p = *string_ptr;
  206.  
  207.   val.format = '?';
  208.   val.size = '?';
  209.   val.count = 1;
  210.  
  211.   if (*p >= '0' && *p <= '9')
  212.     val.count = atoi (p);
  213.   while (*p >= '0' && *p <= '9') p++;
  214.  
  215.   /* Now process size or format letters that follow.  */
  216.  
  217.   while (1)
  218.     {
  219.       if (*p == 'b' || *p == 'h' || *p == 'w' || *p == 'g')
  220.     val.size = *p++;
  221. #ifdef CC_HAS_LONG_LONG
  222.       else if (*p == 'l')
  223.     {
  224.       val.size = 'g';
  225.       p++;
  226.     }
  227. #endif
  228.       else if (*p >= 'a' && *p <= 'z')
  229.     val.format = *p++;
  230.       else
  231.     break;
  232.     }
  233.  
  234. #ifndef CC_HAS_LONG_LONG
  235.   /* Make sure 'g' size is not used on integer types.
  236.      Well, actually, we can handle hex.  */
  237.   if (val.size == 'g' && val.format != 'f' && val.format != 'x')
  238.     val.size = 'w';
  239. #endif
  240.  
  241.   while (*p == ' ' || *p == '\t') p++;
  242.   *string_ptr = p;
  243.  
  244.   /* Set defaults for format and size if not specified.  */
  245.   if (val.format == '?')
  246.     {
  247.       if (val.size == '?')
  248.     {
  249.       /* Neither has been specified.  */
  250.       val.format = oformat;
  251.       val.size = osize;
  252.     }
  253.       else
  254.     /* If a size is specified, any format makes a reasonable
  255.        default except 'i'.  */
  256.     val.format = oformat == 'i' ? 'x' : oformat;
  257.     }
  258.   else if (val.size == '?')
  259.     switch (val.format)
  260.       {
  261.       case 'a':
  262.       case 's':
  263.     /* Addresses must be words.  */
  264.     val.size = osize ? 'w' : osize;
  265.     break;
  266.       case 'f':
  267.     /* Floating point has to be word or giantword.  */
  268.     if (osize == 'w' || osize == 'g')
  269.       val.size = osize;
  270.     else
  271.       /* Default it to giantword if the last used size is not
  272.          appropriate.  */
  273.       val.size = osize ? 'g' : osize;
  274.     break;
  275.       case 'c':
  276.     /* Characters default to one byte.  */
  277.     val.size = osize ? 'b' : osize;
  278.     break;
  279.       default:
  280.     /* The default is the size most recently specified.  */
  281.     val.size = osize;
  282.       }
  283.  
  284.   return val;
  285. }
  286.  
  287. /* Print value VAL on stdout according to FORMAT, a letter or 0.
  288.    Do not end with a newline.
  289.    0 means print VAL according to its own type.
  290.    SIZE is the letter for the size of datum being printed.
  291.    This is used to pad hex numbers so they line up.  */
  292.  
  293. static void
  294. print_formatted (val, format, size)
  295.      register value val;
  296.      register int format;
  297.      int size;
  298. {
  299.   int len = TYPE_LENGTH (VALUE_TYPE (val));
  300.  
  301.   if (VALUE_LVAL (val) == lval_memory)
  302.     next_address = VALUE_ADDRESS (val) + len;
  303.  
  304.   switch (format)
  305.     {
  306.     case 's':
  307.       next_address = VALUE_ADDRESS (val)
  308.     + value_print (value_addr (val), stdout, format, Val_pretty_default);
  309.       break;
  310.  
  311.     case 'i':
  312.       wrap_here ("");    /* Force output out, print_insn not using _filtered */
  313.       next_address = VALUE_ADDRESS (val)
  314.     + print_insn (VALUE_ADDRESS (val), stdout);
  315.       break;
  316.  
  317.     default:
  318.       if (format == 0
  319.       || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_ARRAY
  320.       || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_STRING
  321.       || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_STRUCT
  322.       || TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_UNION
  323.       || VALUE_REPEATED (val))
  324.     value_print (val, stdout, format, Val_pretty_default);
  325.       else
  326.     print_scalar_formatted (VALUE_CONTENTS (val), VALUE_TYPE (val),
  327.                 format, size, stdout);
  328.     }
  329. }
  330.  
  331. /* Print a scalar of data of type TYPE, pointed to in GDB by VALADDR,
  332.    according to letters FORMAT and SIZE on STREAM.
  333.    FORMAT may not be zero.  Formats s and i are not supported at this level.
  334.  
  335.    This is how the elements of an array or structure are printed
  336.    with a format.  */
  337.  
  338. void
  339. print_scalar_formatted (valaddr, type, format, size, stream)
  340.      char *valaddr;
  341.      struct type *type;
  342.      int format;
  343.      int size;
  344.      FILE *stream;
  345. {
  346.   LONGEST val_long;
  347.   int len = TYPE_LENGTH (type);
  348.  
  349.   if (size == 'g' && sizeof (LONGEST) < 8
  350.       && format == 'x')
  351.     {
  352.       /* ok, we're going to have to get fancy here.  Assumption: a
  353.          long is four bytes.  FIXME.  */
  354.       unsigned long v1, v2;
  355.  
  356.       v1 = unpack_long (builtin_type_long, valaddr);
  357.       v2 = unpack_long (builtin_type_long, valaddr + 4);
  358.  
  359. #if TARGET_BYTE_ORDER == LITTLE_ENDIAN
  360.       /* Swap the two for printing */
  361.       {
  362.         unsigned long tmp;
  363.  
  364.         tmp = v1;
  365.         v1 = v2;
  366.         v2 = tmp;
  367.       }
  368. #endif
  369.   
  370.       switch (format)
  371.     {
  372.     case 'x':
  373.       fprintf_filtered (stream, local_hex_format_custom("08x%08"), v1, v2);
  374.       break;
  375.     default:
  376.       error ("Output size \"g\" unimplemented for format \"%c\".",
  377.          format);
  378.     }
  379.       return;
  380.     }
  381.       
  382.   val_long = unpack_long (type, valaddr);
  383.  
  384.   /* If value is unsigned, truncate it in case negative.  */
  385.   if (format != 'd')
  386.     {
  387.       if (len == sizeof (char))
  388.     val_long &= (1 << 8 * sizeof(char)) - 1;
  389.       else if (len == sizeof (short))
  390.     val_long &= (1 << 8 * sizeof(short)) - 1;
  391.       else if (len == sizeof (long))
  392.     val_long &= (unsigned long) - 1;
  393.     }
  394.  
  395.   switch (format)
  396.     {
  397.     case 'x':
  398.       if (!size)
  399.     {
  400.       /* no size specified, like in print.  Print varying # of digits. */
  401.       print_longest (stream, 'x', 1, val_long);
  402.     }
  403.       else
  404.     switch (size)
  405.       {
  406.       case 'b':
  407.       case 'h':
  408.       case 'w':
  409.       case 'g':
  410.         print_longest (stream, size, 1, val_long);
  411.         break;
  412.       default:
  413.         error ("Undefined output size \"%c\".", size);
  414.       }
  415.       break;
  416.  
  417.     case 'd':
  418.       print_longest (stream, 'd', 1, val_long);
  419.       break;
  420.  
  421.     case 'u':
  422.       print_longest (stream, 'u', 0, val_long);
  423.       break;
  424.  
  425.     case 'o':
  426.       if (val_long)
  427.     print_longest (stream, 'o', 1, val_long);
  428.       else
  429.     fprintf_filtered (stream, "0");
  430.       break;
  431.  
  432.     case 'a':
  433.       print_address (unpack_pointer (type, valaddr), stream);
  434.       break;
  435.  
  436.     case 'c':
  437.       value_print (value_from_longest (builtin_type_char, val_long), stream, 0,
  438.            Val_pretty_default);
  439.       break;
  440.  
  441.     case 'f':
  442.       if (len == sizeof (float))
  443.     type = builtin_type_float;
  444.       else if (len == sizeof (double))
  445.     type = builtin_type_double;
  446.       print_floating (valaddr, type, stream);
  447.       break;
  448.  
  449.     case 0:
  450.       abort ();
  451.  
  452.     case 't':
  453.       /* Binary; 't' stands for "two".  */
  454.       {
  455.         char bits[8*(sizeof val_long) + 1];
  456.     char *cp = bits;
  457.     int width;
  458.  
  459.         if (!size)
  460.       width = 8*(sizeof val_long);
  461.         else
  462.           switch (size)
  463.         {
  464.         case 'b':
  465.           width = 8;
  466.           break;
  467.         case 'h':
  468.           width = 16;
  469.           break;
  470.         case 'w':
  471.           width = 32;
  472.           break;
  473.         case 'g':
  474.           width = 64;
  475.           break;
  476.         default:
  477.           error ("Undefined output size \"%c\".", size);
  478.         }
  479.  
  480.         bits[width] = '\0';
  481.         while (width-- > 0)
  482.           {
  483.             bits[width] = (val_long & 1) ? '1' : '0';
  484.             val_long >>= 1;
  485.           }
  486.     if (!size)
  487.       {
  488.         while (*cp && *cp == '0')
  489.           cp++;
  490.         if (*cp == '\0')
  491.           cp--;
  492.       }
  493.     fprintf_filtered (stream, local_binary_format_prefix());
  494.         fprintf_filtered (stream, cp);
  495.     fprintf_filtered (stream, local_binary_format_suffix());
  496.       }
  497.       break;
  498.  
  499.     default:
  500.       error ("Undefined output format \"%c\".", format);
  501.     }
  502. }
  503.  
  504. /* Specify default address for `x' command.
  505.    `info lines' uses this.  */
  506.  
  507. void
  508. set_next_address (addr)
  509.      CORE_ADDR addr;
  510. {
  511.   next_address = addr;
  512.  
  513.   /* Make address available to the user as $_.  */
  514.   set_internalvar (lookup_internalvar ("_"),
  515.            value_from_longest (lookup_pointer_type (builtin_type_void),
  516.                     (LONGEST) addr));
  517. }
  518.  
  519. /* Optionally print address ADDR symbolically as <SYMBOL+OFFSET> on STREAM,
  520.    after LEADIN.  Print nothing if no symbolic name is found nearby.
  521.    DO_DEMANGLE controls whether to print a symbol in its native "raw" form,
  522.    or to interpret it as a possible C++ name and convert it back to source
  523.    form.  However note that DO_DEMANGLE can be overridden by the specific
  524.    settings of the demangle and asm_demangle variables. */
  525.  
  526. void
  527. print_address_symbolic (addr, stream, do_demangle, leadin)
  528.      CORE_ADDR addr;
  529.      FILE *stream;
  530.      int do_demangle;
  531.      char *leadin;
  532. {
  533.   CORE_ADDR name_location;
  534.   register struct symbol *symbol;
  535.   char *name;
  536.  
  537.   /* First try to find the address in the symbol tables to find
  538.      static functions. If that doesn't succeed we try the minimal symbol
  539.      vector for symbols in non-text space.
  540.      FIXME: Should find a way to get at the static non-text symbols too.  */
  541.   
  542.   symbol = find_pc_function (addr);
  543.   if (symbol)
  544.     {
  545.     name_location = BLOCK_START (SYMBOL_BLOCK_VALUE (symbol));
  546.     if (do_demangle)
  547.       name = SYMBOL_SOURCE_NAME (symbol);
  548.     else
  549.       name = SYMBOL_LINKAGE_NAME (symbol);
  550.     }
  551.   else
  552.     {
  553.     register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (addr);
  554.  
  555.     /* If nothing comes out, don't print anything symbolic.  */
  556.     if (msymbol == NULL)
  557.       return;
  558.     name_location = SYMBOL_VALUE_ADDRESS (msymbol);
  559.     if (do_demangle)
  560.       name = SYMBOL_SOURCE_NAME (msymbol);
  561.     else
  562.       name = SYMBOL_LINKAGE_NAME (msymbol);
  563.     }
  564.  
  565.   /* If the nearest symbol is too far away, don't print anything symbolic.  */
  566.  
  567.   /* For when CORE_ADDR is larger than unsigned int, we do math in
  568.      CORE_ADDR.  But when we detect unsigned wraparound in the
  569.      CORE_ADDR math, we ignore this test and print the offset,
  570.      because addr+max_symbolic_offset has wrapped through the end
  571.      of the address space back to the beginning, giving bogus comparison.  */
  572.   if (addr > name_location + max_symbolic_offset
  573.       && name_location + max_symbolic_offset > name_location)
  574.     return;
  575.  
  576.   fputs_filtered (leadin, stream);
  577.   fputs_filtered ("<", stream);
  578.   fputs_filtered (name, stream);
  579.   if (addr != name_location)
  580.     fprintf_filtered (stream, "+%d>", (int)(addr - name_location));
  581.   else
  582.     fputs_filtered (">", stream);
  583. }
  584.  
  585. /* Print address ADDR symbolically on STREAM.
  586.    First print it as a number.  Then perhaps print
  587.    <SYMBOL + OFFSET> after the number.  */
  588.  
  589. void
  590. print_address (addr, stream)
  591.      CORE_ADDR addr;
  592.      FILE *stream;
  593. {
  594. #ifdef ADDR_BITS_REMOVE
  595.   fprintf_filtered (stream, local_hex_format(), ADDR_BITS_REMOVE(addr));
  596. #else
  597.   fprintf_filtered (stream, local_hex_format(), addr);
  598. #endif
  599.   print_address_symbolic (addr, stream, asm_demangle, " ");
  600. }
  601.  
  602. /* Print address ADDR symbolically on STREAM.  Parameter DEMANGLE
  603.    controls whether to print the symbolic name "raw" or demangled.
  604.    Global setting "addressprint" controls whether to print hex address
  605.    or not.  */
  606.  
  607. void
  608. print_address_demangle (addr, stream, do_demangle)
  609.      CORE_ADDR addr;
  610.      FILE *stream;
  611.      int do_demangle;
  612. {
  613.   if (addr == 0) {
  614.     fprintf_filtered (stream, "0");
  615.   } else if (addressprint) {
  616.     fprintf_filtered (stream, local_hex_format(), addr);
  617.     print_address_symbolic (addr, stream, do_demangle, " ");
  618.   } else {
  619.     print_address_symbolic (addr, stream, do_demangle, "");
  620.   }
  621. }
  622.  
  623.  
  624. /* Examine data at address ADDR in format FMT.
  625.    Fetch it from memory and print on stdout.  */
  626.  
  627. static void
  628. do_examine (fmt, addr)
  629.      struct format_data fmt;
  630.      CORE_ADDR addr;
  631. {
  632.   register char format = 0;
  633.   register char size;
  634.   register int count = 1;
  635.   struct type *val_type;
  636.   register int i;
  637.   register int maxelts;
  638.  
  639.   format = fmt.format;
  640.   size = fmt.size;
  641.   count = fmt.count;
  642.   next_address = addr;
  643.  
  644.   /* String or instruction format implies fetch single bytes
  645.      regardless of the specified size.  */
  646.   if (format == 's' || format == 'i')
  647.     size = 'b';
  648.  
  649.   if (size == 'b')
  650.     val_type = builtin_type_char;
  651.   else if (size == 'h')
  652.     val_type = builtin_type_short;
  653.   else if (size == 'w')
  654.     val_type = builtin_type_long;
  655.   else if (size == 'g')
  656. #ifndef CC_HAS_LONG_LONG
  657.     val_type = builtin_type_double;
  658. #else
  659.     val_type = builtin_type_long_long;
  660. #endif
  661.  
  662.   maxelts = 8;
  663.   if (size == 'w')
  664.     maxelts = 4;
  665.   if (size == 'g')
  666.     maxelts = 2;
  667.   if (format == 's' || format == 'i')
  668.     maxelts = 1;
  669.  
  670.   /* Print as many objects as specified in COUNT, at most maxelts per line,
  671.      with the address of the next one at the start of each line.  */
  672.  
  673.   while (count > 0)
  674.     {
  675.       print_address (next_address, stdout);
  676.       printf_filtered (":");
  677.       for (i = maxelts;
  678.        i > 0 && count > 0;
  679.        i--, count--)
  680.     {
  681.       printf_filtered ("\t");
  682.       /* Note that print_formatted sets next_address for the next
  683.          object.  */
  684.       last_examine_address = next_address;
  685.       last_examine_value = value_at (val_type, next_address);
  686.       print_formatted (last_examine_value, format, size);
  687.     }
  688.       printf_filtered ("\n");
  689.       fflush (stdout);
  690.     }
  691. }
  692.  
  693. static void
  694. validate_format (fmt, cmdname)
  695.      struct format_data fmt;
  696.      char *cmdname;
  697. {
  698.   if (fmt.size != 0)
  699.     error ("Size letters are meaningless in \"%s\" command.", cmdname);
  700.   if (fmt.count != 1)
  701.     error ("Item count other than 1 is meaningless in \"%s\" command.",
  702.        cmdname);
  703.   if (fmt.format == 'i' || fmt.format == 's')
  704.     error ("Format letter \"%c\" is meaningless in \"%s\" command.",
  705.        fmt.format, cmdname);
  706. }
  707.  
  708. /*  Evaluate string EXP as an expression in the current language and
  709.     print the resulting value.  EXP may contain a format specifier as the
  710.     first argument ("/x myvar" for example, to print myvar in hex).
  711.     */
  712.  
  713. static void
  714. print_command_1 (exp, inspect, voidprint)
  715.      char *exp;
  716.      int inspect;
  717.      int voidprint;
  718. {
  719.   struct expression *expr;
  720.   register struct cleanup *old_chain = 0;
  721.   register char format = 0;
  722.   register value val;
  723.   struct format_data fmt;
  724.   int cleanup = 0;
  725.  
  726.   /* Pass inspect flag to the rest of the print routines in a global (sigh). */
  727.   inspect_it = inspect;
  728.  
  729.   if (exp && *exp == '/')
  730.     {
  731.       exp++;
  732.       fmt = decode_format (&exp, last_format, 0);
  733.       validate_format (fmt, "print");
  734.       last_format = format = fmt.format;
  735.     }
  736.   else
  737.     {
  738.       fmt.count = 1;
  739.       fmt.format = 0;
  740.       fmt.size = 0;
  741.     }
  742.  
  743.   if (exp && *exp)
  744.     {
  745.       extern int objectprint;
  746.       struct type *type;
  747.       expr = parse_expression (exp);
  748.       old_chain = make_cleanup (free_current_contents, &expr);
  749.       cleanup = 1;
  750.       val = evaluate_expression (expr);
  751.  
  752.       /* C++: figure out what type we actually want to print it as.  */
  753.       type = VALUE_TYPE (val);
  754.  
  755.       if (objectprint
  756.       && (   TYPE_CODE (type) == TYPE_CODE_PTR
  757.           || TYPE_CODE (type) == TYPE_CODE_REF)
  758.       && (   TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT
  759.           || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_UNION))
  760.     {
  761.       value v;
  762.  
  763.       v = value_from_vtable_info (val, TYPE_TARGET_TYPE (type));
  764.       if (v != 0)
  765.         {
  766.           val = v;
  767.           type = VALUE_TYPE (val);
  768.         }
  769.     }
  770.     }
  771.   else
  772.     val = access_value_history (0);
  773.  
  774.   if (voidprint || (val && VALUE_TYPE (val) &&
  775.                     TYPE_CODE (VALUE_TYPE (val)) != TYPE_CODE_VOID))
  776.     {
  777.       int histindex = record_latest_value (val);
  778.  
  779.       if (inspect)
  780.     printf ("\031(gdb-makebuffer \"%s\"  %d '(\"", exp, histindex);
  781.       else
  782.     if (histindex >= 0) printf_filtered ("$%d = ", histindex);
  783.  
  784.       print_formatted (val, format, fmt.size);
  785.       printf_filtered ("\n");
  786.       if (inspect)
  787.     printf("\") )\030");
  788.     }
  789.  
  790.   if (cleanup)
  791.     do_cleanups (old_chain);
  792.   inspect_it = 0;    /* Reset print routines to normal */
  793. }
  794.  
  795. /* ARGSUSED */
  796. static void
  797. print_command (exp, from_tty)
  798.      char *exp;
  799.      int from_tty;
  800. {
  801.   print_command_1 (exp, 0, 1);
  802. }
  803.  
  804. /* Same as print, except in epoch, it gets its own window */
  805. /* ARGSUSED */
  806. static void
  807. inspect_command (exp, from_tty)
  808.      char *exp;
  809.      int from_tty;
  810. {
  811.   extern int epoch_interface;
  812.  
  813.   print_command_1 (exp, epoch_interface, 1);
  814. }
  815.  
  816. /* Same as print, except it doesn't print void results. */
  817. /* ARGSUSED */
  818. static void
  819. call_command (exp, from_tty)
  820.      char *exp;
  821.      int from_tty;
  822. {
  823.   print_command_1 (exp, 0, 0);
  824. }
  825.  
  826. /* ARGSUSED */
  827. static void
  828. output_command (exp, from_tty)
  829.      char *exp;
  830.      int from_tty;
  831. {
  832.   struct expression *expr;
  833.   register struct cleanup *old_chain;
  834.   register char format = 0;
  835.   register value val;
  836.   struct format_data fmt;
  837.  
  838.   if (exp && *exp == '/')
  839.     {
  840.       exp++;
  841.       fmt = decode_format (&exp, 0, 0);
  842.       validate_format (fmt, "output");
  843.       format = fmt.format;
  844.     }
  845.  
  846.   expr = parse_expression (exp);
  847.   old_chain = make_cleanup (free_current_contents, &expr);
  848.  
  849.   val = evaluate_expression (expr);
  850.  
  851.   print_formatted (val, format, fmt.size);
  852.  
  853.   do_cleanups (old_chain);
  854. }
  855.  
  856. /* ARGSUSED */
  857. static void
  858. set_command (exp, from_tty)
  859.      char *exp;
  860.      int from_tty;
  861. {
  862.   struct expression *expr = parse_expression (exp);
  863.   register struct cleanup *old_chain
  864.     = make_cleanup (free_current_contents, &expr);
  865.   evaluate_expression (expr);
  866.   do_cleanups (old_chain);
  867. }
  868.  
  869. /* ARGSUSED */
  870. static void
  871. address_info (exp, from_tty)
  872.      char *exp;
  873.      int from_tty;
  874. {
  875.   register struct symbol *sym;
  876.   register struct minimal_symbol *msymbol;
  877.   register long val;
  878.   register long basereg;
  879.   int is_a_field_of_this;    /* C++: lookup_symbol sets this to nonzero
  880.                    if exp is a field of `this'. */
  881.  
  882.   if (exp == 0)
  883.     error ("Argument required.");
  884.  
  885.   sym = lookup_symbol (exp, get_selected_block (), VAR_NAMESPACE, 
  886.                &is_a_field_of_this, (struct symtab **)NULL);
  887.   if (sym == NULL)
  888.     {
  889.       if (is_a_field_of_this)
  890.     {
  891.       printf ("Symbol \"%s\" is a field of the local class variable `this'\n", exp);
  892.       return;
  893.     }
  894.  
  895.       msymbol = lookup_minimal_symbol (exp, (struct objfile *) NULL);
  896.  
  897.       if (msymbol != NULL)
  898.     printf ("Symbol \"%s\" is at %s in a file compiled without debugging.\n",
  899.         exp, local_hex_string(SYMBOL_VALUE_ADDRESS (msymbol)));
  900.       else
  901.     error ("No symbol \"%s\" in current context.", exp);
  902.       return;
  903.     }
  904.  
  905.   printf ("Symbol \"%s\" is ", SYMBOL_NAME (sym));
  906.   val = SYMBOL_VALUE (sym);
  907.   basereg = SYMBOL_BASEREG (sym);
  908.  
  909.   switch (SYMBOL_CLASS (sym))
  910.     {
  911.     case LOC_CONST:
  912.     case LOC_CONST_BYTES:
  913.       printf ("constant");
  914.       break;
  915.  
  916.     case LOC_LABEL:
  917.       printf ("a label at address %s", local_hex_string(SYMBOL_VALUE_ADDRESS (sym)));
  918.       break;
  919.  
  920.     case LOC_REGISTER:
  921.       printf ("a variable in register %s", reg_names[val]);
  922.       break;
  923.  
  924.     case LOC_STATIC:
  925.       printf ("static storage at address %s", local_hex_string(SYMBOL_VALUE_ADDRESS (sym)));
  926.       break;
  927.  
  928.     case LOC_REGPARM:
  929.       printf ("an argument in register %s", reg_names[val]);
  930.       break;
  931.  
  932.    case LOC_REGPARM_ADDR:
  933.      printf ("address of an argument in register %s", reg_names[val]);
  934.      break;
  935.       
  936.     case LOC_ARG:
  937.       if (SYMBOL_BASEREG_VALID (sym))
  938.     {
  939.       printf ("an argument at offset %ld from register %s",
  940.           val, reg_names[basereg]);
  941.     }
  942.       else
  943.     {
  944.       printf ("an argument at offset %ld", val);
  945.     }
  946.       break;
  947.  
  948.     case LOC_LOCAL_ARG:
  949.       if (SYMBOL_BASEREG_VALID (sym))
  950.     {
  951.       printf ("an argument at offset %ld from register %s",
  952.           val, reg_names[basereg]);
  953.     }
  954.       else
  955.     {
  956.       printf ("an argument at frame offset %ld", val);
  957.     }
  958.       break;
  959.  
  960.     case LOC_LOCAL:
  961.       if (SYMBOL_BASEREG_VALID (sym))
  962.     {
  963.       printf ("a local variable at offset %ld from register %s",
  964.           val, reg_names[basereg]);
  965.     }
  966.       else
  967.     {
  968.       printf ("a local variable at frame offset %ld", val);
  969.     }
  970.       break;
  971.  
  972.     case LOC_REF_ARG:
  973.       printf ("a reference argument at offset %ld", val);
  974.       break;
  975.  
  976.     case LOC_TYPEDEF:
  977.       printf ("a typedef");
  978.       break;
  979.  
  980.     case LOC_BLOCK:
  981.       printf ("a function at address %s",
  982.           local_hex_string(BLOCK_START (SYMBOL_BLOCK_VALUE (sym))));
  983.       break;
  984.  
  985.     case LOC_OPTIMIZED_OUT:
  986.       printf_filtered ("optimized out");
  987.       break;
  988.       
  989.     default:
  990.       printf ("of unknown (botched) type");
  991.       break;
  992.     }
  993.   printf (".\n");
  994. }
  995.  
  996. static void
  997. x_command (exp, from_tty)
  998.      char *exp;
  999.      int from_tty;
  1000. {
  1001.   struct expression *expr;
  1002.   struct format_data fmt;
  1003.   struct cleanup *old_chain;
  1004.   struct value *val;
  1005.  
  1006.   fmt.format = last_format;
  1007.   fmt.size = last_size;
  1008.   fmt.count = 1;
  1009.  
  1010.   if (exp && *exp == '/')
  1011.     {
  1012.       exp++;
  1013.       fmt = decode_format (&exp, last_format, last_size);
  1014.     }
  1015.  
  1016.   /* If we have an expression, evaluate it and use it as the address.  */
  1017.  
  1018.   if (exp != 0 && *exp != 0)
  1019.     {
  1020.       expr = parse_expression (exp);
  1021.       /* Cause expression not to be there any more
  1022.      if this command is repeated with Newline.
  1023.      But don't clobber a user-defined command's definition.  */
  1024.       if (from_tty)
  1025.     *exp = 0;
  1026.       old_chain = make_cleanup (free_current_contents, &expr);
  1027.       val = evaluate_expression (expr);
  1028.       if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF)
  1029.     val = value_ind (val);
  1030.       /* In rvalue contexts, such as this, functions are coerced into
  1031.      pointers to functions.  This makes "x/i main" work.  */
  1032.       if (/* last_format == 'i'
  1033.       && */ TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC
  1034.       && VALUE_LVAL (val) == lval_memory)
  1035.     next_address = VALUE_ADDRESS (val);
  1036.       else
  1037.     next_address = value_as_pointer (val);
  1038.       do_cleanups (old_chain);
  1039.     }
  1040.  
  1041.   do_examine (fmt, next_address);
  1042.  
  1043.   /* If the examine succeeds, we remember its size and format for next time.  */
  1044.   last_size = fmt.size;
  1045.   last_format = fmt.format;
  1046.  
  1047.   /* Set a couple of internal variables if appropriate. */
  1048.   if (last_examine_value)
  1049.     {
  1050.       /* Make last address examined available to the user as $_.  Use
  1051.      the correct pointer type.  */
  1052.       set_internalvar (lookup_internalvar ("_"),
  1053.            value_from_longest (
  1054.          lookup_pointer_type (VALUE_TYPE (last_examine_value)),
  1055.                    (LONGEST) last_examine_address));
  1056.       
  1057.       /* Make contents of last address examined available to the user as $__.*/
  1058.       set_internalvar (lookup_internalvar ("__"), last_examine_value);
  1059.     }
  1060. }
  1061.  
  1062.  
  1063. /* Add an expression to the auto-display chain.
  1064.    Specify the expression.  */
  1065.  
  1066. static void
  1067. display_command (exp, from_tty)
  1068.      char *exp;
  1069.      int from_tty;
  1070. {
  1071.   struct format_data fmt;
  1072.   register struct expression *expr;
  1073.   register struct display *new;
  1074.  
  1075.   if (exp == 0)
  1076.     {
  1077.       do_displays ();
  1078.       return;
  1079.     }
  1080.  
  1081.   if (*exp == '/')
  1082.     {
  1083.       exp++;
  1084.       fmt = decode_format (&exp, 0, 0);
  1085.       if (fmt.size && fmt.format == 0)
  1086.     fmt.format = 'x';
  1087.       if (fmt.format == 'i' || fmt.format == 's')
  1088.     fmt.size = 'b';
  1089.     }
  1090.   else
  1091.     {
  1092.       fmt.format = 0;
  1093.       fmt.size = 0;
  1094.       fmt.count = 0;
  1095.     }
  1096.  
  1097.   innermost_block = 0;
  1098.   expr = parse_expression (exp);
  1099.  
  1100.   new = (struct display *) xmalloc (sizeof (struct display));
  1101.  
  1102.   new->exp = expr;
  1103.   new->block = innermost_block;
  1104.   new->next = display_chain;
  1105.   new->number = ++display_number;
  1106.   new->format = fmt;
  1107.   new->status = enabled;
  1108.   display_chain = new;
  1109.  
  1110.   if (from_tty && target_has_execution)
  1111.     do_one_display (new);
  1112.  
  1113.   dont_repeat ();
  1114. }
  1115.  
  1116. static void
  1117. free_display (d)
  1118.      struct display *d;
  1119. {
  1120.   free ((PTR)d->exp);
  1121.   free ((PTR)d);
  1122. }
  1123.  
  1124. /* Clear out the display_chain.
  1125.    Done when new symtabs are loaded, since this invalidates
  1126.    the types stored in many expressions.  */
  1127.  
  1128. void
  1129. clear_displays ()
  1130. {
  1131.   register struct display *d;
  1132.  
  1133.   while ((d = display_chain) != NULL)
  1134.     {
  1135.       free ((PTR)d->exp);
  1136.       display_chain = d->next;
  1137.       free ((PTR)d);
  1138.     }
  1139. }
  1140.  
  1141. /* Delete the auto-display number NUM.  */
  1142.  
  1143. static void
  1144. delete_display (num)
  1145.      int num;
  1146. {
  1147.   register struct display *d1, *d;
  1148.  
  1149.   if (!display_chain)
  1150.     error ("No display number %d.", num);
  1151.  
  1152.   if (display_chain->number == num)
  1153.     {
  1154.       d1 = display_chain;
  1155.       display_chain = d1->next;
  1156.       free_display (d1);
  1157.     }
  1158.   else
  1159.     for (d = display_chain; ; d = d->next)
  1160.       {
  1161.     if (d->next == 0)
  1162.       error ("No display number %d.", num);
  1163.     if (d->next->number == num)
  1164.       {
  1165.         d1 = d->next;
  1166.         d->next = d1->next;
  1167.         free_display (d1);
  1168.         break;
  1169.       }
  1170.       }
  1171. }
  1172.  
  1173. /* Delete some values from the auto-display chain.
  1174.    Specify the element numbers.  */
  1175.  
  1176. static void
  1177. undisplay_command (args, from_tty)
  1178.      char *args;
  1179.      int from_tty;
  1180. {
  1181.   register char *p = args;
  1182.   register char *p1;
  1183.   register int num;
  1184.  
  1185.   if (args == 0)
  1186.     {
  1187.       if (query ("Delete all auto-display expressions? "))
  1188.     clear_displays ();
  1189.       dont_repeat ();
  1190.       return;
  1191.     }
  1192.  
  1193.   while (*p)
  1194.     {
  1195.       p1 = p;
  1196.       while (*p1 >= '0' && *p1 <= '9') p1++;
  1197.       if (*p1 && *p1 != ' ' && *p1 != '\t')
  1198.     error ("Arguments must be display numbers.");
  1199.  
  1200.       num = atoi (p);
  1201.  
  1202.       delete_display (num);
  1203.  
  1204.       p = p1;
  1205.       while (*p == ' ' || *p == '\t') p++;
  1206.     }
  1207.   dont_repeat ();
  1208. }
  1209.  
  1210. /* Display a single auto-display.  
  1211.    Do nothing if the display cannot be printed in the current context,
  1212.    or if the display is disabled. */
  1213.  
  1214. static void
  1215. do_one_display (d)
  1216.      struct display *d;
  1217. {
  1218.   int within_current_scope;
  1219.  
  1220.   if (d->status == disabled)
  1221.     return;
  1222.  
  1223.   if (d->block)
  1224.     within_current_scope = contained_in (get_selected_block (), d->block);
  1225.   else
  1226.     within_current_scope = 1;
  1227.   if (!within_current_scope)
  1228.     return;
  1229.  
  1230.   current_display_number = d->number;
  1231.  
  1232.   printf_filtered ("%d: ", d->number);
  1233.   if (d->format.size)
  1234.     {
  1235.       CORE_ADDR addr;
  1236.       
  1237.       printf_filtered ("x/");
  1238.       if (d->format.count != 1)
  1239.     printf_filtered ("%d", d->format.count);
  1240.       printf_filtered ("%c", d->format.format);
  1241.       if (d->format.format != 'i' && d->format.format != 's')
  1242.     printf_filtered ("%c", d->format.size);
  1243.       printf_filtered (" ");
  1244.       print_expression (d->exp, stdout);
  1245.       if (d->format.count != 1)
  1246.     printf_filtered ("\n");
  1247.       else
  1248.     printf_filtered ("  ");
  1249.       
  1250.       addr = value_as_pointer (evaluate_expression (d->exp));
  1251.       if (d->format.format == 'i')
  1252.     addr = ADDR_BITS_REMOVE (addr);
  1253.       
  1254.       do_examine (d->format, addr);
  1255.     }
  1256.   else
  1257.     {
  1258.       if (d->format.format)
  1259.     printf_filtered ("/%c ", d->format.format);
  1260.       print_expression (d->exp, stdout);
  1261.       printf_filtered (" = ");
  1262.       print_formatted (evaluate_expression (d->exp),
  1263.                d->format.format, d->format.size);
  1264.       printf_filtered ("\n");
  1265.     }
  1266.  
  1267.   fflush (stdout);
  1268.   current_display_number = -1;
  1269. }
  1270.  
  1271. /* Display all of the values on the auto-display chain which can be
  1272.    evaluated in the current scope.  */
  1273.  
  1274. void
  1275. do_displays ()
  1276. {
  1277.   register struct display *d;
  1278.  
  1279.   for (d = display_chain; d; d = d->next)
  1280.     do_one_display (d);
  1281. }
  1282.  
  1283. /* Delete the auto-display which we were in the process of displaying.
  1284.    This is done when there is an error or a signal.  */
  1285.  
  1286. void
  1287. disable_display (num)
  1288.      int num;
  1289. {
  1290.   register struct display *d;
  1291.  
  1292.   for (d = display_chain; d; d = d->next)
  1293.     if (d->number == num)
  1294.       {
  1295.     d->status = disabled;
  1296.     return;
  1297.       }
  1298.   printf ("No display number %d.\n", num);
  1299. }
  1300.   
  1301. void
  1302. disable_current_display ()
  1303. {
  1304.   if (current_display_number >= 0)
  1305.     {
  1306.       disable_display (current_display_number);
  1307.       fprintf (stderr, "Disabling display %d to avoid infinite recursion.\n",
  1308.            current_display_number);
  1309.     }
  1310.   current_display_number = -1;
  1311. }
  1312.  
  1313. static void
  1314. display_info (ignore, from_tty)
  1315.      char *ignore;
  1316.      int from_tty;
  1317. {
  1318.   register struct display *d;
  1319.  
  1320.   if (!display_chain)
  1321.     printf ("There are no auto-display expressions now.\n");
  1322.   else
  1323.       printf_filtered ("Auto-display expressions now in effect:\n\
  1324. Num Enb Expression\n");
  1325.  
  1326.   for (d = display_chain; d; d = d->next)
  1327.     {
  1328.       printf_filtered ("%d:   %c  ", d->number, "ny"[(int)d->status]);
  1329.       if (d->format.size)
  1330.     printf_filtered ("/%d%c%c ", d->format.count, d->format.size,
  1331.         d->format.format);
  1332.       else if (d->format.format)
  1333.     printf_filtered ("/%c ", d->format.format);
  1334.       print_expression (d->exp, stdout);
  1335.       if (d->block && !contained_in (get_selected_block (), d->block))
  1336.     printf_filtered (" (cannot be evaluated in the current context)");
  1337.       printf_filtered ("\n");
  1338.       fflush (stdout);
  1339.     }
  1340. }
  1341.  
  1342. static void
  1343. enable_display (args, from_tty)
  1344.      char *args;
  1345.      int from_tty;
  1346. {
  1347.   register char *p = args;
  1348.   register char *p1;
  1349.   register int num;
  1350.   register struct display *d;
  1351.  
  1352.   if (p == 0)
  1353.     {
  1354.       for (d = display_chain; d; d = d->next)
  1355.     d->status = enabled;
  1356.     }
  1357.   else
  1358.     while (*p)
  1359.       {
  1360.     p1 = p;
  1361.     while (*p1 >= '0' && *p1 <= '9')
  1362.       p1++;
  1363.     if (*p1 && *p1 != ' ' && *p1 != '\t')
  1364.       error ("Arguments must be display numbers.");
  1365.     
  1366.     num = atoi (p);
  1367.     
  1368.     for (d = display_chain; d; d = d->next)
  1369.       if (d->number == num)
  1370.         {
  1371.           d->status = enabled;
  1372.           goto win;
  1373.         }
  1374.     printf ("No display number %d.\n", num);
  1375.       win:
  1376.     p = p1;
  1377.     while (*p == ' ' || *p == '\t')
  1378.       p++;
  1379.       }
  1380. }
  1381.  
  1382. /* ARGSUSED */
  1383. static void
  1384. disable_display_command (args, from_tty)
  1385.      char *args;
  1386.      int from_tty;
  1387. {
  1388.   register char *p = args;
  1389.   register char *p1;
  1390.   register struct display *d;
  1391.  
  1392.   if (p == 0)
  1393.     {
  1394.       for (d = display_chain; d; d = d->next)
  1395.     d->status = disabled;
  1396.     }
  1397.   else
  1398.     while (*p)
  1399.       {
  1400.     p1 = p;
  1401.     while (*p1 >= '0' && *p1 <= '9')
  1402.       p1++;
  1403.     if (*p1 && *p1 != ' ' && *p1 != '\t')
  1404.       error ("Arguments must be display numbers.");
  1405.     
  1406.     disable_display (atoi (p));
  1407.  
  1408.     p = p1;
  1409.     while (*p == ' ' || *p == '\t')
  1410.       p++;
  1411.       }
  1412. }
  1413.  
  1414.  
  1415. /* Print the value in stack frame FRAME of a variable
  1416.    specified by a struct symbol.  */
  1417.  
  1418. void
  1419. print_variable_value (var, frame, stream)
  1420.      struct symbol *var;
  1421.      FRAME frame;
  1422.      FILE *stream;
  1423. {
  1424.   value val = read_var_value (var, frame);
  1425.   value_print (val, stream, 0, Val_pretty_default);
  1426. }
  1427.  
  1428. /* Print the arguments of a stack frame, given the function FUNC
  1429.    running in that frame (as a symbol), the info on the frame,
  1430.    and the number of args according to the stack frame (or -1 if unknown).  */
  1431.  
  1432. /* References here and elsewhere to "number of args according to the
  1433.    stack frame" appear in all cases to refer to "number of ints of args
  1434.    according to the stack frame".  At least for VAX, i386, isi.  */
  1435.  
  1436. void
  1437. print_frame_args (func, fi, num, stream)
  1438.      struct symbol *func;
  1439.      struct frame_info *fi;
  1440.      int num;
  1441.      FILE *stream;
  1442. {
  1443.   struct block *b;
  1444.   int nsyms = 0;
  1445.   int first = 1;
  1446.   register int i;
  1447.   register struct symbol *sym;
  1448.   register value val;
  1449.   /* Offset of next stack argument beyond the one we have seen that is
  1450.      at the highest offset.
  1451.      -1 if we haven't come to a stack argument yet.  */
  1452.   long highest_offset = -1;
  1453.   int arg_size;
  1454.   /* Number of ints of arguments that we have printed so far.  */
  1455.   int args_printed = 0;
  1456.  
  1457.   if (func)
  1458.     {
  1459.       b = SYMBOL_BLOCK_VALUE (func);
  1460.       nsyms = BLOCK_NSYMS (b);
  1461.     }
  1462.  
  1463.   for (i = 0; i < nsyms; i++)
  1464.     {
  1465.       QUIT;
  1466.       sym = BLOCK_SYM (b, i);
  1467.  
  1468.       /* Keep track of the highest stack argument offset seen, and
  1469.      skip over any kinds of symbols we don't care about.  */
  1470.  
  1471.       switch (SYMBOL_CLASS (sym)) {
  1472.       case LOC_ARG:
  1473.       case LOC_REF_ARG:
  1474.     {
  1475.       long current_offset = SYMBOL_VALUE (sym);
  1476.  
  1477.       arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym));
  1478.       
  1479.       /* Compute address of next argument by adding the size of
  1480.          this argument and rounding to an int boundary.  */
  1481.       current_offset
  1482.         = ((current_offset + arg_size + sizeof (int) - 1)
  1483.            & ~(sizeof (int) - 1));
  1484.  
  1485.       /* If this is the highest offset seen yet, set highest_offset.  */
  1486.       if (highest_offset == -1
  1487.           || (current_offset > highest_offset))
  1488.         highest_offset = current_offset;
  1489.  
  1490.       /* Add the number of ints we're about to print to args_printed.  */
  1491.       args_printed += (arg_size + sizeof (int) - 1) / sizeof (int);
  1492.     }
  1493.  
  1494.       /* We care about types of symbols, but don't need to keep track of
  1495.      stack offsets in them.  */
  1496.       case LOC_REGPARM:
  1497.       case LOC_REGPARM_ADDR:
  1498.       case LOC_LOCAL_ARG:
  1499.     break;
  1500.  
  1501.       /* Other types of symbols we just skip over.  */
  1502.       default:
  1503.     continue;
  1504.       }
  1505.  
  1506.       /* We have to look up the symbol because arguments can have
  1507.      two entries (one a parameter, one a local) and the one we
  1508.      want is the local, which lookup_symbol will find for us.
  1509.      This includes gcc1 (not gcc2) on the sparc when passing a
  1510.      small structure and gcc2 when the argument type is float
  1511.      and it is passed as a double and converted to float by
  1512.      the prologue (in the latter case the type of the LOC_ARG
  1513.      symbol is double and the type of the LOC_LOCAL symbol is
  1514.      float).  There are also LOC_ARG/LOC_REGISTER pairs which
  1515.      are not combined in symbol-reading.  */
  1516.       /* But if the parameter name is null, don't try it.
  1517.      Null parameter names occur on the RS/6000, for traceback tables.
  1518.      FIXME, should we even print them?  */
  1519.  
  1520.       if (*SYMBOL_NAME (sym))
  1521.         sym = lookup_symbol
  1522.       (SYMBOL_NAME (sym),
  1523.        b, VAR_NAMESPACE, (int *)NULL, (struct symtab **)NULL);
  1524.  
  1525.       /* Print the current arg.  */
  1526.       if (! first)
  1527.     fprintf_filtered (stream, ", ");
  1528.       wrap_here ("    ");
  1529.       fprintf_symbol_filtered (stream, SYMBOL_SOURCE_NAME (sym),
  1530.                    SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI);
  1531.       fputs_filtered ("=", stream);
  1532.  
  1533.       /* Avoid value_print because it will deref ref parameters.  We just
  1534.      want to print their addresses.  Print ??? for args whose address
  1535.      we do not know.  We pass 2 as "recurse" to val_print because our
  1536.      standard indentation here is 4 spaces, and val_print indents
  1537.      2 for each recurse.  */
  1538.       val = read_var_value (sym, FRAME_INFO_ID (fi));
  1539.       if (val)
  1540.         val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), VALUE_ADDRESS (val),
  1541.            stream, 0, 0, 2, Val_no_prettyprint);
  1542.       else
  1543.     fputs_filtered ("???", stream);
  1544.       first = 0;
  1545.     }
  1546.  
  1547.   /* Don't print nameless args in situations where we don't know
  1548.      enough about the stack to find them.  */
  1549.   if (num != -1)
  1550.     {
  1551.       long start;
  1552.  
  1553.       if (highest_offset == -1)
  1554.     start = FRAME_ARGS_SKIP;
  1555.       else
  1556.     start = highest_offset;
  1557.  
  1558.       print_frame_nameless_args (fi, start, num - args_printed,
  1559.                  first, stream);
  1560.     }
  1561. }
  1562.  
  1563. /* Print nameless args on STREAM.
  1564.    FI is the frameinfo for this frame, START is the offset
  1565.    of the first nameless arg, and NUM is the number of nameless args to
  1566.    print.  FIRST is nonzero if this is the first argument (not just
  1567.    the first nameless arg).  */
  1568. static void
  1569. print_frame_nameless_args (fi, start, num, first, stream)
  1570.      struct frame_info *fi;
  1571.      long start;
  1572.      int num;
  1573.      int first;
  1574.      FILE *stream;
  1575. {
  1576.   int i;
  1577.   CORE_ADDR argsaddr;
  1578.   long arg_value;
  1579.  
  1580.   for (i = 0; i < num; i++)
  1581.     {
  1582.       QUIT;
  1583. #ifdef NAMELESS_ARG_VALUE
  1584.       NAMELESS_ARG_VALUE (fi, start, &arg_value);
  1585. #else
  1586.       argsaddr = FRAME_ARGS_ADDRESS (fi);
  1587.       if (!argsaddr)
  1588.     return;
  1589.  
  1590.       arg_value = read_memory_integer (argsaddr + start, sizeof (int));
  1591. #endif
  1592.  
  1593.       if (!first)
  1594.     fprintf_filtered (stream, ", ");
  1595.  
  1596. #ifdef    PRINT_NAMELESS_INTEGER
  1597.       PRINT_NAMELESS_INTEGER (stream, arg_value);
  1598. #else
  1599. #ifdef PRINT_TYPELESS_INTEGER
  1600.       PRINT_TYPELESS_INTEGER (stream, builtin_type_int, (LONGEST) arg_value);
  1601. #else
  1602.       fprintf_filtered (stream, "%d", arg_value);
  1603. #endif /* PRINT_TYPELESS_INTEGER */
  1604. #endif /* PRINT_NAMELESS_INTEGER */
  1605.       first = 0;
  1606.       start += sizeof (int);
  1607.     }
  1608. }
  1609.  
  1610. /* ARGSUSED */
  1611. static void
  1612. printf_command (arg, from_tty)
  1613.      char *arg;
  1614.      int from_tty;
  1615. {
  1616.   register char *f;
  1617.   register char *s = arg;
  1618.   char *string;
  1619.   value *val_args;
  1620.   int nargs = 0;
  1621.   int allocated_args = 20;
  1622.   char *arg_bytes;
  1623.  
  1624.   val_args = (value *) xmalloc (allocated_args * sizeof (value));
  1625.  
  1626.   if (s == 0)
  1627.     error_no_arg ("format-control string and values to print");
  1628.  
  1629.   /* Skip white space before format string */
  1630.   while (*s == ' ' || *s == '\t') s++;
  1631.  
  1632.   /* A format string should follow, enveloped in double quotes */
  1633.   if (*s++ != '"')
  1634.     error ("Bad format string, missing '\"'.");
  1635.  
  1636.   /* Parse the format-control string and copy it into the string STRING,
  1637.      processing some kinds of escape sequence.  */
  1638.  
  1639.   f = string = (char *) alloca (strlen (s) + 1);
  1640.   while (*s != '"')
  1641.     {
  1642.       int c = *s++;
  1643.       switch (c)
  1644.     {
  1645.     case '\0':
  1646.       error ("Bad format string, non-terminated '\"'.");
  1647.       /* doesn't return */
  1648.  
  1649.     case '\\':
  1650.       switch (c = *s++)
  1651.         {
  1652.         case '\\':
  1653.           *f++ = '\\';
  1654.           break;
  1655.         case 'n':
  1656.           *f++ = '\n';
  1657.           break;
  1658.         case 't':
  1659.           *f++ = '\t';
  1660.           break;
  1661.         case 'r':
  1662.           *f++ = '\r';
  1663.           break;
  1664.         case '"':
  1665.           *f++ = '"';
  1666.           break;
  1667.         default:
  1668.           /* ??? TODO: handle other escape sequences */
  1669.           error ("Unrecognized \\ escape character in format string.");
  1670.         }
  1671.       break;
  1672.  
  1673.     default:
  1674.       *f++ = c;
  1675.     }
  1676.     }
  1677.  
  1678.   /* Skip over " and following space and comma.  */
  1679.   s++;
  1680.   *f++ = '\0';
  1681.   while (*s == ' ' || *s == '\t') s++;
  1682.  
  1683.   if (*s != ',' && *s != 0)
  1684.     error ("Invalid argument syntax");
  1685.  
  1686.   if (*s == ',') s++;
  1687.   while (*s == ' ' || *s == '\t') s++;
  1688.  
  1689.   {
  1690.     /* Now scan the string for %-specs and see what kinds of args they want.
  1691.        argclass[I] classifies the %-specs so we can give vprintf something
  1692.        of the right size.  */
  1693.  
  1694.     enum argclass {int_arg, string_arg, double_arg, long_long_arg};
  1695.     enum argclass *argclass;
  1696.     int nargs_wanted;
  1697.     int argindex;
  1698.     int lcount;
  1699.     int i;
  1700.  
  1701.     argclass = (enum argclass *) alloca (strlen (s) * sizeof *argclass);
  1702.     nargs_wanted = 0;
  1703.     f = string;
  1704.     while (*f)
  1705.       if (*f++ == '%')
  1706.     {
  1707.       lcount = 0;
  1708.       while (strchr ("0123456789.hlL-+ #", *f)) 
  1709.         {
  1710.           if (*f == 'l' || *f == 'L')
  1711.         lcount++;
  1712.           f++;
  1713.         }
  1714.       if (*f == 's')
  1715.         argclass[nargs_wanted++] = string_arg;
  1716.       else if (*f == 'e' || *f == 'f' || *f == 'g')
  1717.         argclass[nargs_wanted++] = double_arg;
  1718.       else if (lcount > 1)
  1719.         argclass[nargs_wanted++] = long_long_arg;
  1720.       else if (*f != '%')
  1721.         argclass[nargs_wanted++] = int_arg;
  1722.       f++;
  1723.     }
  1724.  
  1725.     /* Now, parse all arguments and evaluate them.
  1726.        Store the VALUEs in VAL_ARGS.  */
  1727.  
  1728.     while (*s != '\0')
  1729.       {
  1730.     char *s1;
  1731.     if (nargs == allocated_args)
  1732.       val_args = (value *) xrealloc ((char *) val_args,
  1733.                      (allocated_args *= 2)
  1734.                      * sizeof (value));
  1735.     s1 = s;
  1736.     val_args[nargs] = parse_to_comma_and_eval (&s1);
  1737.  
  1738.     /* If format string wants a float, unchecked-convert the value to
  1739.        floating point of the same size */
  1740.  
  1741.     if (argclass[nargs] == double_arg)
  1742.       {
  1743.         if (TYPE_LENGTH (VALUE_TYPE (val_args[nargs])) == sizeof (float))
  1744.           VALUE_TYPE (val_args[nargs]) = builtin_type_float;
  1745.         if (TYPE_LENGTH (VALUE_TYPE (val_args[nargs])) == sizeof (double))
  1746.           VALUE_TYPE (val_args[nargs]) = builtin_type_double;
  1747.       }
  1748.     nargs++;
  1749.     s = s1;
  1750.     if (*s == ',')
  1751.       s++;
  1752.       }
  1753.  
  1754.     if (nargs != nargs_wanted)
  1755.       error ("Wrong number of arguments for specified format-string");
  1756.  
  1757.     /* Now lay out an argument-list containing the arguments
  1758.        as doubles, integers and C pointers.  */
  1759.  
  1760.     arg_bytes = (char *) alloca (sizeof (double) * nargs);
  1761.     argindex = 0;
  1762.     for (i = 0; i < nargs; i++)
  1763.       {
  1764.     if (argclass[i] == string_arg)
  1765.       {
  1766.         char *str;
  1767.         CORE_ADDR tem;
  1768.         int j;
  1769.         tem = value_as_pointer (val_args[i]);
  1770.  
  1771.         /* This is a %s argument.  Find the length of the string.  */
  1772.         for (j = 0; ; j++)
  1773.           {
  1774.         char c;
  1775.         QUIT;
  1776.         read_memory (tem + j, &c, 1);
  1777.         if (c == 0)
  1778.           break;
  1779.           }
  1780.  
  1781.         /* Copy the string contents into a string inside GDB.  */
  1782.         str = (char *) alloca (j + 1);
  1783.         read_memory (tem, str, j);
  1784.         str[j] = 0;
  1785.  
  1786.         /* Pass address of internal copy as the arg to vprintf.  */
  1787.         *((int *) &arg_bytes[argindex]) = (int) str;
  1788.         argindex += sizeof (int);
  1789.       }
  1790.     else if (VALUE_TYPE (val_args[i])->code == TYPE_CODE_FLT)
  1791.       {
  1792.         *((double *) &arg_bytes[argindex]) = value_as_double (val_args[i]);
  1793.         argindex += sizeof (double);
  1794.       }
  1795.     else
  1796. #ifdef CC_HAS_LONG_LONG
  1797.       if (argclass[i] == long_long_arg)
  1798.         {
  1799.           *(LONGEST *) &arg_bytes[argindex] = value_as_long (val_args[i]);
  1800.           argindex += sizeof (LONGEST);
  1801.         }
  1802.       else
  1803. #endif
  1804.         {
  1805.           *((long *) &arg_bytes[argindex]) = value_as_long (val_args[i]);
  1806.           argindex += sizeof (long);
  1807.         }
  1808.       }
  1809.   }
  1810.  
  1811.   /* There is not a standard way to make a va_list, so we need
  1812.      to do various things for different systems.  */
  1813. #if defined (__INT_VARARGS_H)
  1814.   {
  1815.     va_list list;
  1816.  
  1817.     list.__va_arg = 0;
  1818.     list.__va_stk = (int *) arg_bytes;
  1819.     list.__va_reg = (int *) arg_bytes;
  1820.     vprintf (string, list);
  1821.   }
  1822. #else /* No __INT_VARARGS_H.  */
  1823.   vprintf (string, arg_bytes);
  1824. #endif /* No __INT_VARARGS_H.  */
  1825. }
  1826.  
  1827. /* Helper function for asdump_command.  Finds the bounds of a function
  1828.    for a specified section of text.  PC is an address within the
  1829.    function which you want bounds for; *LOW and *HIGH are set to the
  1830.    beginning (inclusive) and end (exclusive) of the function.  This
  1831.    function returns 1 on success and 0 on failure.  */
  1832.  
  1833. static int
  1834. containing_function_bounds (pc, low, high)
  1835.      CORE_ADDR pc, *low, *high;
  1836. {
  1837.   CORE_ADDR scan;
  1838.   CORE_ADDR limit;
  1839.   struct obj_section *sec;
  1840.  
  1841.   if (!find_pc_partial_function (pc, 0, low))
  1842.     return 0;
  1843.  
  1844.   sec = find_pc_section (pc);
  1845.   if (sec == NULL)
  1846.     return 0;
  1847.   limit = sec->endaddr;
  1848.   
  1849.   scan = *low;
  1850.   while (scan < limit)
  1851.     {
  1852.       ++scan;
  1853.       if (!find_pc_partial_function (scan, 0, high))
  1854.     return 0;
  1855.       if (*low != *high)
  1856.     return 1;
  1857.     }
  1858.   *high = limit;
  1859.   return 1;
  1860. }
  1861.  
  1862. /* Dump a specified section of assembly code.  With no command line
  1863.    arguments, this command will dump the assembly code for the
  1864.    function surrounding the pc value in the selected frame.  With one
  1865.    argument, it will dump the assembly code surrounding that pc value.
  1866.    Two arguments are interpeted as bounds within which to dump
  1867.    assembly.  */
  1868.  
  1869. /* ARGSUSED */
  1870. static void
  1871. disassemble_command (arg, from_tty)
  1872.      char *arg;
  1873.      int from_tty;
  1874. {
  1875.   CORE_ADDR low, high;
  1876.   CORE_ADDR pc;
  1877.   char *space_index;
  1878.  
  1879.   if (!arg)
  1880.     {
  1881.       if (!selected_frame)
  1882.     error ("No frame selected.\n");
  1883.  
  1884.       pc = get_frame_pc (selected_frame);
  1885.       if (!containing_function_bounds (pc, &low, &high))
  1886.     error ("No function contains pc specified by selected frame.\n");
  1887.     }
  1888.   else if (!(space_index = (char *) strchr (arg, ' ')))
  1889.     {
  1890.       /* One argument.  */
  1891.       pc = parse_and_eval_address (arg);
  1892.       if (!containing_function_bounds (pc, &low, &high))
  1893.     error ("No function contains specified pc.\n");
  1894.     }
  1895.   else
  1896.     {
  1897.       /* Two arguments.  */
  1898.       *space_index = '\0';
  1899.       low = parse_and_eval_address (arg);
  1900.       high = parse_and_eval_address (space_index + 1);
  1901.     }
  1902.  
  1903.   printf_filtered ("Dump of assembler code ");
  1904.   if (!space_index)
  1905.     {
  1906.       char *name;
  1907.       find_pc_partial_function (pc, &name, 0);
  1908.       printf_filtered ("for function %s:\n", name);
  1909.     }
  1910.   else
  1911.     {
  1912.       printf_filtered ("from %s ", local_hex_string(low));
  1913.       printf_filtered ("to %s:\n", local_hex_string(high));
  1914.     }
  1915.  
  1916.   /* Dump the specified range.  */
  1917.   for (pc = low; pc < high; )
  1918.     {
  1919.       QUIT;
  1920.       print_address (pc, stdout);
  1921.       printf_filtered (":\t");
  1922.       pc += print_insn (pc, stdout);
  1923.       printf_filtered ("\n");
  1924.     }
  1925.   printf_filtered ("End of assembler dump.\n");
  1926.   fflush (stdout);
  1927. }
  1928.  
  1929.  
  1930. void
  1931. _initialize_printcmd ()
  1932. {
  1933.   current_display_number = -1;
  1934.  
  1935.   add_info ("address", address_info,
  1936.        "Describe where variable VAR is stored.");
  1937.  
  1938.   add_com ("x", class_vars, x_command,
  1939.        "Examine memory: x/FMT ADDRESS.\n\
  1940. ADDRESS is an expression for the memory address to examine.\n\
  1941. FMT is a repeat count followed by a format letter and a size letter.\n\
  1942. Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),\n\
  1943.   t(binary), f(float), a(address), i(instruction), c(char) and s(string).\n\
  1944. Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).\n\
  1945. The specified number of objects of the specified size are printed\n\
  1946. according to the format.\n\n\
  1947. Defaults for format and size letters are those previously used.\n\
  1948. Default count is 1.  Default address is following last thing printed\n\
  1949. with this command or \"print\".");
  1950.  
  1951.   add_com ("disassemble", class_vars, disassemble_command,
  1952.        "Disassemble a specified section of memory.\n\
  1953. Default is the function surrounding the pc of the selected frame.\n\
  1954. With a single argument, the function surrounding that address is dumped.\n\
  1955. Two arguments are taken as a range of memory to dump.");
  1956.  
  1957. #if 0
  1958.   add_com ("whereis", class_vars, whereis_command,
  1959.        "Print line number and file of definition of variable.");
  1960. #endif
  1961.   
  1962.   add_info ("display", display_info,
  1963.         "Expressions to display when program stops, with code numbers.");
  1964.  
  1965.   add_cmd ("undisplay", class_vars, undisplay_command,
  1966.        "Cancel some expressions to be displayed when program stops.\n\
  1967. Arguments are the code numbers of the expressions to stop displaying.\n\
  1968. No argument means cancel all automatic-display expressions.\n\
  1969. \"delete display\" has the same effect as this command.\n\
  1970. Do \"info display\" to see current list of code numbers.",
  1971.           &cmdlist);
  1972.  
  1973.   add_com ("display", class_vars, display_command,
  1974.        "Print value of expression EXP each time the program stops.\n\
  1975. /FMT may be used before EXP as in the \"print\" command.\n\
  1976. /FMT \"i\" or \"s\" or including a size-letter is allowed,\n\
  1977. as in the \"x\" command, and then EXP is used to get the address to examine\n\
  1978. and examining is done as in the \"x\" command.\n\n\
  1979. With no argument, display all currently requested auto-display expressions.\n\
  1980. Use \"undisplay\" to cancel display requests previously made.");
  1981.  
  1982.   add_cmd ("display", class_vars, enable_display, 
  1983.        "Enable some expressions to be displayed when program stops.\n\
  1984. Arguments are the code numbers of the expressions to resume displaying.\n\
  1985. No argument means enable all automatic-display expressions.\n\
  1986. Do \"info display\" to see current list of code numbers.", &enablelist);
  1987.  
  1988.   add_cmd ("display", class_vars, disable_display_command, 
  1989.        "Disable some expressions to be displayed when program stops.\n\
  1990. Arguments are the code numbers of the expressions to stop displaying.\n\
  1991. No argument means disable all automatic-display expressions.\n\
  1992. Do \"info display\" to see current list of code numbers.", &disablelist);
  1993.  
  1994.   add_cmd ("display", class_vars, undisplay_command, 
  1995.        "Cancel some expressions to be displayed when program stops.\n\
  1996. Arguments are the code numbers of the expressions to stop displaying.\n\
  1997. No argument means cancel all automatic-display expressions.\n\
  1998. Do \"info display\" to see current list of code numbers.", &deletelist);
  1999.  
  2000.   add_com ("printf", class_vars, printf_command,
  2001.     "printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\
  2002. This is useful for formatted output in user-defined commands.");
  2003.   add_com ("output", class_vars, output_command,
  2004.        "Like \"print\" but don't put in value history and don't print newline.\n\
  2005. This is useful in user-defined commands.");
  2006.  
  2007.   add_prefix_cmd ("set", class_vars, set_command,
  2008. "Evaluate expression EXP and assign result to variable VAR, using assignment\n\
  2009. syntax appropriate for the current language (VAR = EXP or VAR := EXP for\n\
  2010. example).  VAR may be a debugger \"convenience\" variable (names starting\n\
  2011. with $), a register (a few standard names starting with $), or an actual\n\
  2012. variable in the program being debugged.  EXP is any valid expression.\n\
  2013. Use \"set variable\" for variables with names identical to set subcommands.\n\
  2014. \nWith a subcommand, this command modifies parts of the gdb environment.\n\
  2015. You can see these environment settings with the \"show\" command.",
  2016.                   &setlist, "set ", 1, &cmdlist);
  2017.  
  2018.   /* "call" is the same as "set", but handy for dbx users to call fns. */
  2019.   add_com ("call", class_vars, call_command,
  2020.        "Call a function in the inferior process.\n\
  2021. The argument is the function name and arguments, in the notation of the\n\
  2022. current working language.  The result is printed and saved in the value\n\
  2023. history, if it is not void.");
  2024.  
  2025.   add_cmd ("variable", class_vars, set_command,
  2026. "Evaluate expression EXP and assign result to variable VAR, using assignment\n\
  2027. syntax appropriate for the current language (VAR = EXP or VAR := EXP for\n\
  2028. example).  VAR may be a debugger \"convenience\" variable (names starting\n\
  2029. with $), a register (a few standard names starting with $), or an actual\n\
  2030. variable in the program being debugged.  EXP is any valid expression.\n\
  2031. This may usually be abbreviated to simply \"set\".",
  2032.            &setlist);
  2033.  
  2034.   add_com ("print", class_vars, print_command,
  2035.        concat ("Print value of expression EXP.\n\
  2036. Variables accessible are those of the lexical environment of the selected\n\
  2037. stack frame, plus all those whose scope is global or an entire file.\n\
  2038. \n\
  2039. $NUM gets previous value number NUM.  $ and $$ are the last two values.\n\
  2040. $$NUM refers to NUM'th value back from the last one.\n\
  2041. Names starting with $ refer to registers (with the values they would have\n\
  2042. if the program were to return to the stack frame now selected, restoring\n\
  2043. all registers saved by frames farther in) or else to debugger\n\
  2044. \"convenience\" variables (any such name not a known register).\n\
  2045. Use assignment expressions to give values to convenience variables.\n",
  2046.            "\n\
  2047. {TYPE}ADREXP refers to a datum of data type TYPE, located at address ADREXP.\n\
  2048. @ is a binary operator for treating consecutive data objects\n\
  2049. anywhere in memory as an array.  FOO@NUM gives an array whose first\n\
  2050. element is FOO, whose second element is stored in the space following\n\
  2051. where FOO is stored, etc.  FOO must be an expression whose value\n\
  2052. resides in memory.\n",
  2053.            "\n\
  2054. EXP may be preceded with /FMT, where FMT is a format letter\n\
  2055. but no count or size letter (see \"x\" command).", NULL));
  2056.   add_com_alias ("p", "print", class_vars, 1);
  2057.  
  2058.   add_com ("inspect", class_vars, inspect_command,
  2059. "Same as \"print\" command, except that if you are running in the epoch\n\
  2060. environment, the value is printed in its own window.");
  2061.  
  2062.   add_show_from_set (
  2063.       add_set_cmd ("max-symbolic-offset", no_class, var_uinteger,
  2064.            (char *)&max_symbolic_offset,
  2065.     "Set the largest offset that will be printed in <symbol+1234> form.",
  2066.            &setprintlist),
  2067.       &showprintlist);
  2068. }
  2069.