当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - How to change a variable value on conditional breakpoint in visual studio 2015

问题描述:

Is there any way to change value of variable to on a conditional breakpoint and continue execution.

My code is like this

switch(var){ //conditional breakpoint on this line

case 1:

break;

...

}

I put conditional breakpoint like below

(var == 0 ) || (var ==1) is true

So when this breakpoint hits, I want to change var = 2, and continue execution.

What I found: I found Action also, but it only log messages. Is there any way to executing a statement like var = 2 as Action taken on this conditional breakpoint.

I don't want to change code because building it takes hell lot of time.

Note: I am working C++ on Visual studio 2015

网友答案:

You can modify a variable directly in memory to change the execution flow through a quick watch (Shift+F9) or watch window in Visual Studio.

网友答案:

Make sure that in Tools / Options / Debugging you have the "Enable Edit and Continue" Enabled/Checked and then you will be able to edit your code while debugging and continue without the need to rebuild or to stop execution.

More information can be found in How to: Enable and Disable Edit and Continue

分享给朋友:
您可能感兴趣的文章:
随机阅读: