Compile this code with debug information for Win32 (i.e. with -m32 or -m32mscoff):
int mightThrow(int x)
{
return x;
}
int main()
{
int x = 3;
if (x == 0) // step in debugger
return 1; // jumps here
scope(exit) x = -1;
mightThrow(1); // and continues here
return 0;
}
Stepping over the if statement shows the return statement as the next instruction, even though the next step continues with the call to mightThrow.
This is caused by the instruction settings the "exception marker" that remembers the code position for unwinding. It is considered to be part of the if statement.
Comment #1 by robert.schadek — 2024-12-13T19:04:11Z