Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Auto-Display.html
blobf9ea8790ceb1fe149c1d899e820ccfe5f05077ae
1 <html lang="en">
2 <head>
3 <title>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.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Auto%20Display">Auto Display</a>,
13 Next:<a rel="next" accesskey="n" href="Print-Settings.html#Print%20Settings">Print Settings</a>,
14 Previous:<a rel="previous" accesskey="p" href="Memory.html#Memory">Memory</a>,
15 Up:<a rel="up" accesskey="u" href="Data.html#Data">Data</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Automatic display</h3>
21 <p>If you find that you want to print the value of an expression frequently
22 (to see how it changes), you might want to add it to the <dfn>automatic
23 display list</dfn> so that GDB prints its value each time your program stops.
24 Each expression added to the list is given a number to identify it;
25 to remove an expression from the list, you specify that number.
26 The automatic display looks like this:
28 <pre class="example"> 2: foo = 38
29 3: bar[5] = (struct hack *) 0x3804
30 </pre>
32 <p>This display shows item numbers, expressions and their current values. As with
33 displays you request manually using <code>x</code> or <code>print</code>, you can
34 specify the output format you prefer; in fact, <code>display</code> decides
35 whether to use <code>print</code> or <code>x</code> depending on how elaborate your
36 format specification is--it uses <code>x</code> if you specify a unit size,
37 or one of the two formats (<code>i</code> and <code>s</code>) that are only
38 supported by <code>x</code>; otherwise it uses <code>print</code>.
40 <dl>
41 <dt><code>display </code><var>expr</var><code></code>
42 <dd>Add the expression <var>expr</var> to the list of expressions to display
43 each time your program stops. See <a href="Expressions.html#Expressions">Expressions</a>.
45 <p><code>display</code> does not repeat if you press &lt;RET&gt; again after using it.
47 <br><dt><code>display/</code><var>fmt</var><code> </code><var>expr</var><code></code>
48 <dd>For <var>fmt</var> specifying only a display format and not a size or
49 count, add the expression <var>expr</var> to the auto-display list but
50 arrange to display it each time in the specified format <var>fmt</var>.
51 See <a href="Output-Formats.html#Output%20Formats">Output formats</a>.
53 <br><dt><code>display/</code><var>fmt</var><code> </code><var>addr</var><code></code>
54 <dd>For <var>fmt</var> <code>i</code> or <code>s</code>, or including a unit-size or a
55 number of units, add the expression <var>addr</var> as a memory address to
56 be examined each time your program stops. Examining means in effect
57 doing <code>x/</code><var>fmt</var><code> </code><var>addr</var><code></code>. See <a href="Memory.html#Memory">Examining memory</a>.
58 </dl>
60 <p>For example, <code>display/i $pc</code> can be helpful, to see the machine
61 instruction about to be executed each time execution stops (<code>$pc</code>
62 is a common name for the program counter; see <a href="Registers.html#Registers">Registers</a>).
64 <dl>
65 <dt><code>undisplay </code><var>dnums</var><code>...</code>
66 <dd><dt><code>delete display </code><var>dnums</var><code>...</code>
67 <dd>Remove item numbers <var>dnums</var> from the list of expressions to display.
69 <p><code>undisplay</code> does not repeat if you press &lt;RET&gt; after using it.
70 (Otherwise you would just get the error <code>No display number ...</code>.)
72 <br><dt><code>disable display </code><var>dnums</var><code>...</code>
73 <dd>Disable the display of item numbers <var>dnums</var>. A disabled display
74 item is not printed automatically, but is not forgotten. It may be
75 enabled again later.
77 <br><dt><code>enable display </code><var>dnums</var><code>...</code>
78 <dd>Enable display of item numbers <var>dnums</var>. It becomes effective once
79 again in auto display of its expression, until you specify otherwise.
81 <br><dt><code>display</code>
82 <dd>Display the current values of the expressions on the list, just as is
83 done when your program stops.
85 <br><dt><code>info display</code>
86 <dd>Print the list of expressions previously set up to display
87 automatically, each one with its item number, but without showing the
88 values. This includes disabled expressions, which are marked as such.
89 It also includes expressions which would not be displayed right now
90 because they refer to automatic variables not currently available.
91 </dl>
93 <p>If a display expression refers to local variables, then it does not make
94 sense outside the lexical context for which it was set up. Such an
95 expression is disabled when execution enters a context where one of its
96 variables is not defined. For example, if you give the command
97 <code>display last_char</code> while inside a function with an argument
98 <code>last_char</code>, GDB displays this argument while your program
99 continues to stop inside that function. When it stops elsewhere--where
100 there is no variable <code>last_char</code>--the display is disabled
101 automatically. The next time your program stops where <code>last_char</code>
102 is meaningful, you can enable the display expression once again.
104 </body></html>