• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/share/doc/arm-arm-none-eabi/html/gdb/
1<html lang="en">
2<head>
3<title>Output - Debugging with GDB</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Debugging with GDB">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Sequences.html#Sequences" title="Sequences">
9<link rel="prev" href="Command-Files.html#Command-Files" title="Command Files">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
131998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
14Free Software Foundation, Inc.
15
16Permission is granted to copy, distribute and/or modify this document
17under the terms of the GNU Free Documentation License, Version 1.3 or
18any later version published by the Free Software Foundation; with the
19Invariant Sections being ``Free Software'' and ``Free Software Needs
20Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
21and with the Back-Cover Texts as in (a) below.
22
23(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
24this GNU Manual.  Buying copies from GNU Press supports the FSF in
25developing GNU and promoting software freedom.''-->
26<meta http-equiv="Content-Style-Type" content="text/css">
27<style type="text/css"><!--
28  pre.display { font-family:inherit }
29  pre.format  { font-family:inherit }
30  pre.smalldisplay { font-family:inherit; font-size:smaller }
31  pre.smallformat  { font-family:inherit; font-size:smaller }
32  pre.smallexample { font-size:smaller }
33  pre.smalllisp    { font-size:smaller }
34  span.sc    { font-variant:small-caps }
35  span.roman { font-family:serif; font-weight:normal; } 
36  span.sansserif { font-family:sans-serif; font-weight:normal; } 
37--></style>
38<link rel="stylesheet" type="text/css" href="../cs.css">
39</head>
40<body>
41<div class="node">
42<a name="Output"></a>
43<p>
44Previous:&nbsp;<a rel="previous" accesskey="p" href="Command-Files.html#Command-Files">Command Files</a>,
45Up:&nbsp;<a rel="up" accesskey="u" href="Sequences.html#Sequences">Sequences</a>
46<hr>
47</div>
48
49<h4 class="subsection">23.1.4 Commands for Controlled Output</h4>
50
51<p>During the execution of a command file or a user-defined command, normal
52<span class="sc">gdb</span> output is suppressed; the only output that appears is what is
53explicitly printed by the commands in the definition.  This section
54describes three commands useful for generating exactly the output you
55want.
56
57     
58<a name="index-echo-1562"></a>
59<dl><dt><code>echo </code><var>text</var><dd><!-- I do not consider backslash-space a standard C escape sequence -->
60<!-- because it is not in ANSI. -->
61Print <var>text</var>.  Nonprinting characters can be included in
62<var>text</var> using C escape sequences, such as &lsquo;<samp><span class="samp">\n</span></samp>&rsquo; to print a
63newline.  <strong>No newline is printed unless you specify one.</strong>
64In addition to the standard C escape sequences, a backslash followed
65by a space stands for a space.  This is useful for displaying a
66string with spaces at the beginning or the end, since leading and
67trailing spaces are otherwise trimmed from all arguments. 
68To print &lsquo;<samp><span class="samp">&nbsp;<!-- /@w -->and foo =&nbsp;<!-- /@w --></span></samp>&rsquo;, use the command
69&lsquo;<samp><span class="samp">echo \&nbsp;<!-- /@w -->and foo = \&nbsp;<!-- /@w --></span></samp>&rsquo;.
70
71     <p>A backslash at the end of <var>text</var> can be used, as in C, to continue
72the command onto subsequent lines.  For example,
73
74     <pre class="smallexample">          echo This is some text\n\
75          which is continued\n\
76          onto several lines.\n
77</pre>
78     <p>produces the same output as
79
80     <pre class="smallexample">          echo This is some text\n
81          echo which is continued\n
82          echo onto several lines.\n
83</pre>
84     <p><a name="index-output-1563"></a><br><dt><code>output </code><var>expression</var><dd>Print the value of <var>expression</var> and nothing but that value: no
85newlines, no &lsquo;<samp><span class="samp">$</span><var>nn</var><span class="samp"> = </span></samp>&rsquo;.  The value is not entered in the
86value history either.  See <a href="Expressions.html#Expressions">Expressions</a>, for more information
87on expressions.
88
89     <br><dt><code>output/</code><var>fmt</var> <var>expression</var><dd>Print the value of <var>expression</var> in format <var>fmt</var>.  You can use
90the same formats as for <code>print</code>.  See <a href="Output-Formats.html#Output-Formats">Output Formats</a>, for more information.
91
92     <p><a name="index-printf-1564"></a><br><dt><code>printf </code><var>template</var><code>, </code><var>expressions</var><code>...</code><dd>Print the values of one or more <var>expressions</var> under the control of
93the string <var>template</var>.  To print several values, make
94<var>expressions</var> be a comma-separated list of individual expressions,
95which may be either numbers or pointers.  Their values are printed as
96specified by <var>template</var>, exactly as a C program would do by
97executing the code below:
98
99     <pre class="smallexample">          printf (<var>template</var>, <var>expressions</var>...);
100</pre>
101     <p>As in <code>C</code> <code>printf</code>, ordinary characters in <var>template</var>
102are printed verbatim, while <dfn>conversion specification</dfn> introduced
103by the &lsquo;<samp><span class="samp">%</span></samp>&rsquo; character cause subsequent <var>expressions</var> to be
104evaluated, their values converted and formatted according to type and
105style information encoded in the conversion specifications, and then
106printed.
107
108     <p>For example, you can print two values in hex like this:
109
110     <pre class="smallexample">          printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
111</pre>
112     <p><code>printf</code> supports all the standard <code>C</code> conversion
113specifications, including the flags and modifiers between the &lsquo;<samp><span class="samp">%</span></samp>&rsquo;
114character and the conversion letter, with the following exceptions:
115
116          <ul>
117<li>The argument-ordering modifiers, such as &lsquo;<samp><span class="samp">2$</span></samp>&rsquo;, are not supported.
118
119          <li>The modifier &lsquo;<samp><span class="samp">*</span></samp>&rsquo; is not supported for specifying precision or
120width.
121
122          <li>The &lsquo;<samp><span class="samp">'</span></samp>&rsquo; flag (for separation of digits into groups according to
123<code>LC_NUMERIC'</code>) is not supported.
124
125          <li>The type modifiers &lsquo;<samp><span class="samp">hh</span></samp>&rsquo;, &lsquo;<samp><span class="samp">j</span></samp>&rsquo;, &lsquo;<samp><span class="samp">t</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">z</span></samp>&rsquo; are not
126supported.
127
128          <li>The conversion letter &lsquo;<samp><span class="samp">n</span></samp>&rsquo; (as in &lsquo;<samp><span class="samp">%n</span></samp>&rsquo;) is not supported.
129
130          <li>The conversion letters &lsquo;<samp><span class="samp">a</span></samp>&rsquo; and &lsquo;<samp><span class="samp">A</span></samp>&rsquo; are not supported. 
131</ul>
132
133     <p class="noindent">Note that the &lsquo;<samp><span class="samp">ll</span></samp>&rsquo; type modifier is supported only if the
134underlying <code>C</code> implementation used to build <span class="sc">gdb</span> supports
135the <code>long long int</code> type, and the &lsquo;<samp><span class="samp">L</span></samp>&rsquo; type modifier is
136supported only if <code>long double</code> type is available.
137
138     <p>As in <code>C</code>, <code>printf</code> supports simple backslash-escape
139sequences, such as <code>\n</code>, &lsquo;<samp><span class="samp">\t</span></samp>&rsquo;, &lsquo;<samp><span class="samp">\\</span></samp>&rsquo;, &lsquo;<samp><span class="samp">\"</span></samp>&rsquo;,
140&lsquo;<samp><span class="samp">\a</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">\f</span></samp>&rsquo;, that consist of backslash followed by a
141single character.  Octal and hexadecimal escape sequences are not
142supported.
143
144     <p>Additionally, <code>printf</code> supports conversion specifications for DFP
145(<dfn>Decimal Floating Point</dfn>) types using the following length modifiers
146together with a floating point specifier. 
147letters:
148
149          <ul>
150<li>&lsquo;<samp><span class="samp">H</span></samp>&rsquo; for printing <code>Decimal32</code> types.
151
152          <li>&lsquo;<samp><span class="samp">D</span></samp>&rsquo; for printing <code>Decimal64</code> types.
153
154          <li>&lsquo;<samp><span class="samp">DD</span></samp>&rsquo; for printing <code>Decimal128</code> types. 
155</ul>
156
157     <p>If the underlying <code>C</code> implementation used to build <span class="sc">gdb</span> has
158support for the three length modifiers for DFP types, other modifiers
159such as width and precision will also be available for <span class="sc">gdb</span> to use.
160
161     <p>In case there is no such <code>C</code> support, no additional modifiers will be
162available and the value will be printed in the standard way.
163
164     <p>Here's an example of printing DFP types using the above conversion letters:
165     <pre class="smallexample">          printf "D32: %Hf - D64: %Df - D128: %DDf\n",1.2345df,1.2E10dd,1.2E1dl
166</pre>
167     <p><a name="index-eval-1565"></a><br><dt><code>eval </code><var>template</var><code>, </code><var>expressions</var><code>...</code><dd>Convert the values of one or more <var>expressions</var> under the control of
168the string <var>template</var> to a command line, and call it.
169
170   </dl>
171
172   </body></html>
173
174