This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GEL Scripting Wait/Pause/Sleep?



Hello.

I'm wondering if there is any way to pause execution of a GEL script for an arbitrary amount of time and resume execution after it has passed. I wasn't able to find anything useful or helpful in the included help document.

What I am trying to do is:

  1. Set a breakpoint. [GEL_BreakPtAdd(address)]
  2. Run. [GEL_Run()]
  3. Sleep here, whatever the estimated time to reach the breakpoint would be.
  4. Disable the breakpoint, verify values. [GEL_BreakPtDel(address)]

If there is a "standard" or "common" way of achieving this, please let me know.

Thanks in advance.

  • Hi Jamie,

    You can use a function like this.

    _wait( int delay )
    {
        int i;
        for( i = 0 ; i < delay ; i++ ){}
    }

    and pass an appropriate delay value every time the function is called.

    Another possible way could be to poll a flag indicating that breakpoint is reached ( not sure, if there is any) using something like

    while(!(FLAG)); which can cause the GEL script to sleep.

    Hope this helps.

    Regards,

    Sid

  • A wait function will work, but the catch is that if the target is halted, and you try to run while gel is "delaying", the run won't occur until after the delay finishes.  This is because the target won't be run until all outstanding debugger requests (including executing gel functions) finish.

    If this is important for your use case, you can use the GEL_SetTimer and GEL_CancelTimer functions for instance.  Just set a timer where you need a delay, and have the callback cancel the timer and do the remainder of the function.

    Darian