The information in this article applies to:
SUMMARY
Code that is written to modify its own contents may run differently
when run one line at a time in the Microsoft CodeView Debugger (CV).
This occurs because of the the way the 80x86 processors fetch
instructions. Because this is a limitation of how CodeView works, care
should be used when debugging self-modifying code.
MORE INFORMATION
The 80x86 processor will try to pre-fetch the next instruction from
memory while processing the current instruction. If the code being
modified is already waiting in the instruction queue, then the
processor will run the unmodified code. However, a jump instruction
will invalidate the queue, causing the next instruction to be fetched
before execution. In self-modifying code, this will cause the modified
instruction to be run. When stepping through a program in CodeView,
the instruction queue is always marked invalid, so all modified
instructions are run. The code below demonstrates this behavior.
Sample Code
Additional query words: kbinf 2.20 3.00 4.00 4.10
Keywords : kb16bitonly |
Last Reviewed: October 28, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |