📄 wdbgexam.gml
字号:
.chap *refid=videxam Examining and Modifying the Program State
.*
.np
The following topics are discussed:
.begbull
.bull
:HDREF refid='wndvar'.
.bull
:HDREF refid='wndmem'.
.endbull
.*
.section *refid=wndvar Variable and Watch Windows
.*
.figure *depth='2.10' *scale=70 *file='dbgvar' The Watch and Variable Window
.np
Windows that display variables come in several different varieties. They
are:
.begbull $compact
.bull
.wnddef Locals
.bull
.wnddef File Variables
.bull
.wnddef Watches
.bull
.wnddef Variable
.endbull
.np
They are collectively called variable windows. You use the same
interactions in all variable windows to
display, modify and browse your variables and data structures.
The only difference between these windows are the variables that
they display. The values in each window
are updated as you trace through your program. The windows
display the following information:
.begnote
.note Locals
Contains the list of variables which are local to the current
routine. Choose
.menuref 'Locals' 'Data'
.ix 'variables' 'local'
to open this window.
.note File Variables
Contains a list of all variables which are defined at file scope in the
current module. This includes external and static symbols. Choose
.menuref 'File Variables' 'Data'
.ix 'variable' 'file scope'
to open this window.
.note Watches
The Watches windows allows you to add and delete variables and expressions.
In other windows you can choose
.popup Watch
.dot
This will open the watches window add the text which is selected in
another window to the watches window.
You can use
.popup New
.ix 'expression' 'evaluate'
:cmt. .ix 'expression' 'typecast'
.ix 'variable' 'typecast'
.ix 'typecast'
to add any expression to the Watches window.
Once entered, you can choose
.popup Edit
to edit the expressions or typecast the variables.
.note Variable
This is another instance of a Watches window. A variable window is created
when you select a variable or expression in a window and use
.popup Inspect
.dot
.endnote
.np
Each line of a variable window has three elements. On the left is
a button.
The button changes depending on the type of the variable or expression.
it changes based on the type of the item:
.begnote
.note structs (classes) (unions)
Structures may be opened and closed by clicking on the button at the
left. When you open a structure or class, one line is added to the
window for each field of the structure. These new lines are indented.
If you click on the button again, the structure is closed and the
window is returned to its original state.
.note arrays
Like structs, arrays may be opened and closed. When you open an array,
one line is added to the window for each element of the array. The
debugger will display at most 1000 elements of an array. If it
contains more you can use
.mi Type/Array...
.ix 'array' 'view slices'
.ix 'array' 'expand'
to open different ranges. Multi dimensional arrays are treated like an
array of arrays. When you open the first dimension, the lines that are
added will also be arrays which you can open.
.note pointers
.ix 'pointer' 'follow'
When the variable is a pointer, you can click on the button and the
debugger will follow the pointer and change the line to represent the
item which is the result of the pointer reference. For example, if you
have a pointer to an integer and click on the button, the integer
value will be displayed. The button then changes to indicate so that
you can undo the operation by clicking on it again.
.np
In the case of pointers to pointers, clicking on the button will
follow the pointers one level each time you click on the button until
a non-pointer value is reached. Clicking on the button at this point
will undo take you back to the original state. When the pointer points
to a struct, the structure will automatically be opened when you click
on the button. If a pointer is really an array, you can use
.popup Type/Array...
.ix 'pointer' 'show as array'
to open it as an array.
.endnote
.np
Next comes the name of the variable, field or array element being
displayed. Finally, the value is displayed. If the item being
displayed is not a scalar item, the value displayed is an indication
that it is a complex data type. If the value changes when you run your
program, it will be highlighted. If a variable goes out of scope, or a
pointer value becomes invalid, the value will be displayed as question
marks.
.np
.ix 'variable' 'modify'
You can modify a variable's value by double clicking on the value
field, or by cursoring to it and pressing enter. Double clicking or
pressing enter on the name field is equivalent to clicking on the
button. Press the right mouse button to access the following pop-up
menu items:
.begmenu Variable Pop-up
.menuitem Modify...
Modify the value of the selected item.
.menuitem Break
.ix 'variable' 'break on write'
.ix 'breakpoint' 'on write'
Set a breakpoint so that execution stops when the selected item's
value changes. This is the same as setting a breakpoint on the
object.
.refalso vidbrk
.note --------
.menuitem Inspect
.ix 'variable' 'inspect'
Open a new Variable window containing the selected item.
If the item is a compound object (array, class, or structure), it
will be opened automatically.
.menuitem Watch
.ix 'variable' 'watch'
Add the selected item to the Watch window.
.menuitem Show/Raw Memory
.ix 'variable' 'show raw storage'
Display raw memory at the address of this variable.
This lets you examine the actual binary representation of a variable.
.menuitem Show/Pointer Memory
.ix 'pointer' 'show memory at'
Display the memory that the item points to.
This is useful when you have a pointer to a block of memory that does
not have a type associated
with it.
.menuitem Show/Pointer Code
.ix 'pointer' 'show code at'
Display the code that the variable points to.
If the item being displayed is a pointer to function, you can use this
menu item to see the definition of that function.
.menuitem Show/Type
.ix 'type' 'show item's type'
.ix 'variable' 'display type'
Display the type of the variable in an information message box.
Select "OK" to dismiss the information box and resume debugging.
.note --------
.menuitem Edit
.ix 'typecast'
.ix 'variable' 'typecast'
Open a dialog box in which you can edit an expression in the Watch
window. This is useful for typecasting variables or evaluating
expressions.
.refalso videxpr
.menuitem New
Add a new variable or expression to the window. You will be prompted
for the expression to add.
.menuitem Delete
Delete the selected item from the window.
.note --------
:CMT. .menuitem Root
:CMT. .ix 'structure' 'find root of'
:CMT. When the selected item is a field of a structure or an element of an
:CMT. array, this menu item moves the currently selected item to the
:CMT. parent of that item. For example, if you are examining
:CMT. .monoon
:CMT. sym->field1->field2
:CMT. .monooff
:CMT. .mi Root
:CMT. will change the current selection to
:CMT. .monoon
:CMT. sym->field1
:CMT. .monooff
:CMT. If you are examining a deeply nested field, use Root repeatedly
:CMT. to find the originating expression.
.menuitem FieldOnTop
.ix 'on top'
Display the value of this member at the top of the structure/class.
You can selectively add or remove items from the list that is
displayed "on top".
For example, say you have a
.id struct Point
displayed as:
.millust begin
[-] point
x 10
y 30
other "asdf"
.millust end
.pc
If you toggle
.mi FieldOnTop
for both
.id x
and
.id y
then
.id point
would be displayed like this:
.millust begin
[-] point { 10, 30 }
x 10
y 30
other "asdf"
.millust end
.pc
Furthermore, if you closed the struct (or pointer to struct) then
you would see:
.millust begin
[+] point { 10, 30 }
.millust end
.np
This carries to structs containing structs (and so on) as shown in the
following struct containing two
.id Point
structures.
.millust begin
[-] rect { { 10, 10 }, { 30, 30 } }
top_left { 10, 10 }
bot_right { 30, 30 }
.millust end
.pc
If you close it, then you will see:
.millust begin
[+] rect { { 10, 10 }, { 30, 30 } }
.millust end
.menuitem Class/Show Functions
Display function members of this object.
If this option is not selected, no functions are displayed.
This option works in conjunction with other
.mi Class
selections to display "Inherited", "Generated", "Private" and
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -