8.7.8.126. OnPreRun()ΒΆ

GEL callback function called before target execution is resumed by the debugger.

Syntax

OnPreRun();

Description

If defined in a loaded GEL file, OnPreRun() will be called before target execution is resumed by the debugger. This applies to run and step requests. However, while disconnecting may cause the target to run freely, OnPreRun will not be called prior to disconnecting. Target execution will not resume until the callback is fully executed. Target execution will be resumed regardless of the result of the callback, even if it throws an error.

The callback should not call any built-in GEL function that is not completely synchronous. Additionally, it should not change the target's connection state, reset the target, or call any of the GEL_MemorySave, GEL_MemoryLoad, or GEL_MemoryFill functions. Accessing registers or dereferencing memory addresses is fine.

Example

OnPreRun()
{
     int x;
     GEL_TextOut("Target is about to resume execution");

     // can access registers
     x = PC
     // can dereference memory locations
     x = *((int*)PC);
}