When I program C/C++ with Visual Studio I often use __asm nop;
command to insert a noop code in order to have something to break on. For instance:
You can just put in any arbitrary assignment statement that doesn't do anything, e.g.
if (someCondition()) {
int t=0;
}
The debugger will be happy to break on this. Since t
is local to the block, it can't possibly have any side effects (and will get JIT-compiled out of existence in production code).
Alternatively, you can write a static function which has a breakpoint permanently set inside it, so you can just do:
if (someCondition()) {
breakPoint();
}