Initializing help system before first use

XPRMdbg_runmod

XPRMdbg_runmod


Purpose
Run a model through the debugger interface.
Synopsis
int XPRMdbg_runmod(XPRMmodel model, int *exitcode, const char *parlist, int (MM_RTC *dbgcb)(void *dctx, int vmstat, int lndx), void *dbgctx);
Arguments
model 
Reference to a model
exitcode 
Pointer to an area where the model exit code value is returned
parlist 
String composed of model parameter initializations separated by commas, may be NULL
dbgcb 
user defined debugger callback
dbgctx 
debug context: it is used as the first argument of dbgcb
Return value
Execution status. Possible values are:
XPRM_RT_OK 
Normal termination
XPRM_RT_ERROR 
An error occured during execution
XPRM_RT_MATHERR 
Mathematical error ( e.g. division by zero)
XPRM_RT_IOERR 
Input/output error ( e.g. cannot open file)
XPRM_RT_STOP 
Bit set if execution has been interrupted
Further information
1. The parameter parlist may be used to initialize the model parameters of the model/program ( e.g. "PAR1=12,PAR2='tutu'"). The bit XPRM_RT_STOP is set if the execution of the model has been interrupted by a call to the function XPRMstoprunmod.
2. The parameter exitcode receives the result of the execution ( i.e. parameter value of the ``exit'' procedure or 0 if the routine was not called), its value is meaningful only when the execution succeeded ( i.e. the status is XPRM_RT_OK).
3. If the function pointer dbgcb if NULL XPRMdbg_runmod behaves like XPRMisrunmod; otherwise function dbgcb is called whenever the model is interrupted (breakpoint, error or function XPRMstoprunmod called). The first argument, dctx, is the value of dbgctx; the second, vmstat, is the virtual machine status ( i.e. XPRM_RT_*) and the last argument, lndx, is the line index corresponding to the statement being executed (asynchronous interruption) or to be executed (breakpoint). In this context the virtual machine status may take value XPRM_RT_BREAK if interruption is due to a breakpoint and value XPRM_RT_NIFCT if the program was executing a native function when interruption occurred.
4. If a breakpoint at line -1 has been set (see XPRMdbg_setbrkp) the debugger callback dbgcb is called just before program termination when no error has occurred. In this case the virtual machine status takes value XPRM_RT_ENDING for a normal termination and value XPRM_RT_EXIT if the last statement is a call to procedure exit.
5. If the program is interrupted because of an error, the return value of dbgcb is ignored, otherwise it indicates how to continue execution. If vmstat is not XPRM_RT_NIFCT, the following values can be returned:
XPRM_DBG_STOP 
terminate execution
XPRM_DBG_NEXT 
stop before the next statement skipping function calls
XPRM_DBG_STEP 
stop before the next statement stepping into function calls
XPRM_DBG_CONT 
continue execution
j>0 
stop before the statement at line index j

6. If the interruption occurs during the execution of a native function (for instance when the optimizer is solving a problem), vmstat is XPRM_RT_NIFCT and execution of the function can be canceled (execution continues after the NI call) by returning XPRM_DBG_STOP (in this case the debugger callback is called again just after the native function call completes). Other values returned by dbgcb imply the continuation of the execution.
Related topics