Home > database >  C debugging - stop on variable change
C debugging - stop on variable change

Time:12-14

I am using vsCode and I would like to know if it is possible to stop the debugger when the value of a variable changes.

I am analyzing code that I have not written and would like see where a certain boolean variable gets changed from false to true.

Is this possible?

CodePudding user response:

This will work by doing into the debug console and typing gdb commands. In this case:

-exec watch myVariable

or by getting the location in memory &myVariable in the watch window.

Copy the location in memory (e.g., 0x555...) and in the debug console type:

-exec watch *memoryLocationOfVariable

CodePudding user response:

Click to the left of the line of code you want then press debug to manually move through each line of code you have selected.

  • Related