Fixing and Continuing in a Debugging Session
See Also
If you find a problem while debugging, you can use
the Apply Code Changes command to fix your source code,
and then continue debugging with the changed code
without restarting your program. Fixing your program and
continuing execution is esecially useful when you make changes
to functions not yet executed.
Take advantage of the Apply Code Changes command to
modify your program in the following ways:
- Add, delete, or change lines of code in functions
- Add or delete functions
- Add or delete global and static variables
You can substitute new versions of functions for old versions when you edit a source file. To minimize the issues associated with doing so:
- Do not change the name of a function.
- Do not add, delete, or change the type of arguments
to a function.
- Do not add, delete, or change the type of local
variables in those functions currently active on the
call stack.
- Do not change the declaration of a C++ template or
template instances. Only the body of a C++ template
function definition can be modified.
To fix your code:
- Choose Debug > Apply Code Changes to recompile and
begin repairing your source code.
- If there are errors during compilation, nothing is changed
in your program. Edit your sorce code as needed, then execute
the Apply Code Changes command again.
- If there are no errors, the resulting object code is swapped
into the currently executing program. However, all calls on
the call stack continue running the unfixed code. To use
the modified code, you must pop from the call stack any
calls that contain modified code (see
Popping a Call From the Call Stack. When the calls are
reentered, they use the modified code.
- Continue executing your program to verify that the fixed version of your code works correctly.
Legal Notices