1 |
578 |
markom |
<HTML>
|
2 |
|
|
<HEAD>
|
3 |
|
|
<TITLE>Watch Window Help</TITLE>
|
4 |
|
|
</HEAD>
|
5 |
|
|
<BODY>
|
6 |
|
|
<H1>The Watch Window</H1>
|
7 |
|
|
<H3>Overview</H3>
|
8 |
|
|
<P>The Watch Window may be used to inspect any collected expression, including
|
9 |
|
|
global variables, static variables, local variables, function arguments,
|
10 |
|
|
and registers.</P>
|
11 |
|
|
|
12 |
|
|
<P>Watch Window topics:
|
13 |
|
|
<UL>
|
14 |
|
|
<LI><UL><A HREF="#menus">Watch Menu</A>
|
15 |
|
|
<LI><A HREF="#menus_fmt">Format</A>
|
16 |
|
|
<LI><A HREF="#menus_remove">Remove</A>
|
17 |
|
|
</UL>
|
18 |
|
|
<LI><UL><A HREF="#new">Adding Watch Expressions</A>
|
19 |
|
|
<LI><A HREF="#new_ent">In the Watch Window</A>
|
20 |
|
|
<LI><A HREF="#new_src">In the Source Window</A>
|
21 |
|
|
<LI><A HREF="#new_cast">Casting Pointers</A>
|
22 |
|
|
</UL>
|
23 |
|
|
<LI><UL><A HREF="#display">Watch Display</A>
|
24 |
|
|
<LI><A HREF="#display_deref">Dereferencing Pointers</A>
|
25 |
|
|
<LI><A HREF="#display_struct">Viewing a Structure or Class</A>
|
26 |
|
|
<LI><A HREF="#display_popup">Watch Pop-up Menu</A>
|
27 |
|
|
</UL>
|
28 |
|
|
</UL></P>
|
29 |
|
|
|
30 |
|
|
<H3><A NAME="menus">Watch Menu</A></H3>
|
31 |
|
|
The Watch Menu gives on-screen access to the funtions of the Watch Window.
|
32 |
|
|
To use any of these functions, first use the left mouse button to select an
|
33 |
|
|
expression from the display. Then select:
|
34 |
|
|
|
35 |
|
|
<DL>
|
36 |
|
|
<DT><A NAME="menus_fmt">Format</A>
|
37 |
|
|
<DD>Change the display format of the expression
|
38 |
|
|
<DT><A NAME="menus_remove">Remove</A>
|
39 |
|
|
<DD>Remove the expression from the Watch Window
|
40 |
|
|
</DL>
|
41 |
|
|
|
42 |
|
|
<H3><A NAME="new">Adding Watch Expressions</A></H3>
|
43 |
|
|
<A NAME="new_ent">To add an expression to the Watch Window</A>, simply enter
|
44 |
|
|
the expression into the entry at the bottom of the window and press return
|
45 |
|
|
or click the "Add Watch" button. The expression is validated and added to the
|
46 |
|
|
Watch Window Display.
|
47 |
|
|
|
48 |
|
|
<P><A NAME="new_src">To add an expression to the Watch Window from the
|
49 |
|
|
<A HREF="source.html">Source Window</A></A>, use the
|
50 |
|
|
"<A HREF="source.html#add_to_watch">Add to Watch</A>" option of the
|
51 |
|
|
<A HREF="source.html#display_popup">Source Window Pop-up Menu</A>.</P>
|
52 |
|
|
|
53 |
|
|
<P>Any legal expression may be added to the Watch Window, which will
|
54 |
|
|
evaluate each of its expressions everytime the program runs. Be cautious
|
55 |
|
|
adding expressions which cause assignments, such as "<CODE>i++</CODE>".</P>
|
56 |
|
|
|
57 |
|
|
<P>Adding a register to the Watch Window can be advantages when debugging
|
58 |
|
|
via a slow serial line. In this case, keeping the entire Register Window open
|
59 |
|
|
may be inefficient. Consider adding the register to the Watch Window. Simply
|
60 |
|
|
enter the name of the register preceded with a dollar sign ($) into the
|
61 |
|
|
Entry. For example, to watch the PC register, enter "<CODE>$pc</CODE>" into
|
62 |
|
|
the Watch Window Entry. The program counter is added to the Display.</P>
|
63 |
|
|
|
64 |
|
|
<P><A NAME="new_cast">To cast pointers</A>, simply enter the cast into the
|
65 |
|
|
Watch Window Entry at the bottom of the window. Use the same syntax for the
|
66 |
|
|
cast that the source file uses. If the source file uses C, the a simple
|
67 |
|
|
cast of "<CODE>ptr</CODE>" of type "<CODE>void *</CODE>" can be cast to type
|
68 |
|
|
"<CODE>my_struct</CODE>" by entering "<CODE>(my_struct *) ptr</CODE>" into
|
69 |
|
|
the Entry.</P>
|
70 |
|
|
|
71 |
|
|
<H3><A NAME="display">Watch Display</A></H3>
|
72 |
|
|
The Watch Window Display consists of a scrolled listbox which contains all
|
73 |
|
|
watch expressions, one per line. To use any of the functions of the Watch
|
74 |
|
|
Window, use the left mouse button to select any element from the Display.
|
75 |
|
|
|
76 |
|
|
<P>Pointers, structures, and classes appear in the display with a small
|
77 |
|
|
exapansion box before their names. To <A NAME="display_deref">dereference
|
78 |
|
|
pointers</A> or <A NAME="display_struct">view the members of classes or
|
79 |
|
|
structures</A>, click the closed expansion box (which appears as a small
|
80 |
|
|
plus sign, "+") to "expand" the listing. The expansion box changes to a
|
81 |
|
|
minus sign, "-", indicating that the display is now open. Pointers,
|
82 |
|
|
structures and classes may be expanded recursively to allow multiple pointer
|
83 |
|
|
dereferences and embedded structure viewing.
|
84 |
|
|
|
85 |
|
|
<P>The Locals Display updates as the trace buffer is navigated, highlighting
|
86 |
|
|
in blue those variables whose values have changed.</P>
|
87 |
|
|
|
88 |
|
|
<P>The Watch Window will, by default, display all pointers in hexadecimal and all
|
89 |
|
|
other variables in decimal. To change the default display of variables, use the
|
90 |
|
|
"set output-radix" command in the console window. (Type "help set output-radix" in the
|
91 |
|
|
console window for help. To make this change permanent, it must be added to the user's
|
92 |
|
|
init file -- .gdbinit under unix and gdb.ini under Windows.) To change the display
|
93 |
|
|
format for a variable, select the Format option from either the Variable Menu or the
|
94 |
|
|
<A HREF="#display_popup">Watch Pop-up Menu</A>.
|
95 |
|
|
<BR>
|
96 |
|
|
|
97 |
|
|
<H4><A NAME="display_popup">Watch Pop-up Menu</A></H4>
|
98 |
|
|
The Watch Pop-up Menu provides quick access to the functions of the Watch Window.
|
99 |
|
|
To use the Locals Pop-up Menu, first select an expression from the Display (by
|
100 |
|
|
clicking the left mouse button on it) and click the right mouse button, choosing
|
101 |
|
|
from the pop-up:
|
102 |
|
|
<DL>
|
103 |
|
|
<DT>Format
|
104 |
|
|
<DD>Change the display format of the expression. The expression may be
|
105 |
|
|
displayed as:
|
106 |
|
|
<DL>
|
107 |
|
|
<DT>Hex
|
108 |
|
|
<DD>hexadecimal (base 16)
|
109 |
|
|
<DT>Decimal
|
110 |
|
|
<DD>decimal (base 10)
|
111 |
|
|
<DT>Binary
|
112 |
|
|
<DD>binary (base 2)
|
113 |
|
|
<DT>Octal
|
114 |
|
|
<DD>octal (base 8)
|
115 |
|
|
</DL>
|
116 |
|
|
</DL>
|
117 |
|
|
</BODY>
|
118 |
|
|
</HTML>
|