debug strange behavior

Dec 26, 2022 at 3:19pm
Hi.
Why my debugger doesn't go sequentially in the code?

Sometimes it goes back (i am not talking about loops). and than continue.

for example:
1
2
iResult = sitalRt_DataBlock_Create(uiDeviceID, DataBlockID, sitalRtDataBlockType_DOUBLE, &DataWordsBuffer[0], 32);
printf("\n\r sitalRt_DataBlock_Create:%i",iResult);


It goes from iResults to printf, and then go back to iResults. it happen in many places.

Thanks in advanced.
Last edited on Dec 26, 2022 at 3:20pm
Dec 26, 2022 at 4:38pm
Which debugger are you using? Are you using it with debug or release build code? How you got any optimisations enabled?
Dec 29, 2022 at 5:28pm
I am using g++

In the highest optimization level. But seems like the reason for those jumps is
because i uses static variables
Dec 29, 2022 at 8:18pm
Many compiler optimizations affect debugging. Consider using -Og

-Og

Optimize debugging experience. -Og should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience. It is a better choice than -O0 for producing debuggable code because some compiler passes that collect debug information are disabled at -O0.
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-Og
Last edited on Dec 29, 2022 at 8:20pm
Topic archived. No new replies allowed.