Changing the Value of a Local
When a new value is typed in the value field of the Locals window, the debug package passes the string, as typed, to the expression evaluator (EE). The EE evaluates this string, which can contain either a simple value or an expression, and stores the resulting value in the associated local.
This is an overview of the process of changing the value of a local:
After the user enters the new value, Visual Studio calls IDebugProperty2::SetValueAsString on the IDebugProperty2 object associated with the local.
IDebugProperty2::SetValueAsString performs the following tasks:
Evaluates the string to produce a value.
Binds the associated IDebugField object to obtain an IDebugObject object.
Converts the value to a series of bytes.
Calls IDebugObject::SetValue to put the value's bytes into memory so the program being debugged can access them.
Visual Studio refreshes the Locals display (see Displaying Locals for details).
This procedure is also used to change the value of a variable in the Watch window except it is the IDebugProperty2 object associated with the value of the local that is used instead of the IDebugProperty2 object associated with the local itself.
In This Section
- Sample Implementation of Changing Values
Uses the MyCEE sample to step through the process of changing values.