gdb: Output

 
 23.1.4 Commands for Controlled Output
 -------------------------------------
 
 During the execution of a command file or a user-defined command, normal
 GDB output is suppressed; the only output that appears is what is
 explicitly printed by the commands in the definition.  This section
 describes three commands useful for generating exactly the output you
 want.
 
 'echo TEXT'
      Print TEXT.  Nonprinting characters can be included in TEXT using C
      escape sequences, such as '\n' to print a newline.  *No newline is
      printed unless you specify one.*  In addition to the standard C
      escape sequences, a backslash followed by a space stands for a
      space.  This is useful for displaying a string with spaces at the
      beginning or the end, since leading and trailing spaces are
      otherwise trimmed from all arguments.  To print ' and foo = ', use
      the command 'echo \ and foo = \ '.
 
      A backslash at the end of TEXT can be used, as in C, to continue
      the command onto subsequent lines.  For example,
 
           echo This is some text\n\
           which is continued\n\
           onto several lines.\n
 
      produces the same output as
 
           echo This is some text\n
           echo which is continued\n
           echo onto several lines.\n
 
 'output EXPRESSION'
      Print the value of EXPRESSION and nothing but that value: no
      newlines, no '$NN = '.  The value is not entered in the value
      history either.  SeeExpressions Expressions, for more
      information on expressions.
 
 'output/FMT EXPRESSION'
      Print the value of EXPRESSION in format FMT.  You can use the same
      formats as for 'print'.  SeeOutput Formats Output Formats, for
      more information.
 
 'printf TEMPLATE, EXPRESSIONS...'
      Print the values of one or more EXPRESSIONS under the control of
      the string TEMPLATE.  To print several values, make EXPRESSIONS be
      a comma-separated list of individual expressions, which may be
      either numbers or pointers.  Their values are printed as specified
      by TEMPLATE, exactly as a C program would do by executing the code
      below:
 
           printf (TEMPLATE, EXPRESSIONS...);
 
      As in 'C' 'printf', ordinary characters in TEMPLATE are printed
      verbatim, while "conversion specification" introduced by the '%'
      character cause subsequent EXPRESSIONS to be evaluated, their
      values converted and formatted according to type and style
      information encoded in the conversion specifications, and then
      printed.
 
      For example, you can print two values in hex like this:
 
           printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
 
      'printf' supports all the standard 'C' conversion specifications,
      including the flags and modifiers between the '%' character and the
      conversion letter, with the following exceptions:
 
         * The argument-ordering modifiers, such as '2$', are not
           supported.
 
         * The modifier '*' is not supported for specifying precision or
           width.
 
         * The ''' flag (for separation of digits into groups according
           to 'LC_NUMERIC'') is not supported.
 
         * The type modifiers 'hh', 'j', 't', and 'z' are not supported.
 
         * The conversion letter 'n' (as in '%n') is not supported.
 
         * The conversion letters 'a' and 'A' are not supported.
 
      Note that the 'll' type modifier is supported only if the
      underlying 'C' implementation used to build GDB supports the 'long
      long int' type, and the 'L' type modifier is supported only if
      'long double' type is available.
 
      As in 'C', 'printf' supports simple backslash-escape sequences,
      such as '\n', '\t', '\\', '\"', '\a', and '\f', that consist of
      backslash followed by a single character.  Octal and hexadecimal
      escape sequences are not supported.
 
      Additionally, 'printf' supports conversion specifications for DFP
      ("Decimal Floating Point") types using the following length
      modifiers together with a floating point specifier.  letters:
 
         * 'H' for printing 'Decimal32' types.
 
         * 'D' for printing 'Decimal64' types.
 
         * 'DD' for printing 'Decimal128' types.
 
      If the underlying 'C' implementation used to build GDB has support
      for the three length modifiers for DFP types, other modifiers such
      as width and precision will also be available for GDB to use.
 
      In case there is no such 'C' support, no additional modifiers will
      be available and the value will be printed in the standard way.
 
      Here's an example of printing DFP types using the above conversion
      letters:
           printf "D32: %Hf - D64: %Df - D128: %DDf\n",1.2345df,1.2E10dd,1.2E1dl
 
 'eval TEMPLATE, EXPRESSIONS...'
      Convert the values of one or more EXPRESSIONS under the control of
      the string TEMPLATE to a command line, and call it.