When I use the debugger of the scripting engine I am able to set a breakpoint.
Basically this is working and I can execute the script step by step.
Problem:
I have a timer which triggers every 10 seconds.
I use a breakpoint to step through the program line by line
As soon as the timer triggers the currently executed line jumps from my breakpoint inside the Timer procedure
=> Debugging is only working with all Timers disabled
Do you have a solution for me how I can do debugging without Timer interference?
Scripter debugging is different than Delphi, conceptually. Especially because scripts are reentrant, and scripter has the "paused" concept, so when a breakpoint is hit, the execution pauses and the IDE shows the current line while paused.
If another execution jumps in (a timer), the current line being executed changes, and the IDE just shows the current line execution, because the script is paused. I'm not sure if there is much that can be done in this case. Would you expect the timer event to be not executed at all?
I would like to have a command to disable the possibility of timer interrupts or even second execution of a script.
Maybe you could define a new command in the source code
Something like
Application.StopInterruptEvents(true);
It’s even a problem, when I am inside a breakpoint and press F9 more than once. In that case I open the script form twice (what I don’t want in most cases).
But in the meanwhile, you can try to use the BeforeExecute event. It's triggered whenever a new script execution is about to start, including handling events. You can try to call Abort in that event whenever you want to prevent execution - for example, if you are debugging.
So in the place where you would call StopInterruptEvents, you could set a flag and call Abort in BeforeExecute if that flag is set.