Abort

Files CCore/inc/Abort.h CCore/src/AbortMsgFunc.cpp HCore/src/Abort.cpp XCore/src/Abort.cpp

There are two functions to abort a program execution with a diagnostic message:


void Abort(StrLen str);
 
void Abort(const char *zstr);

First of them accepts a message text as a StrLen argument, second — as a zero-terminated character string. The exact method of the sending a diagnostic message is target-dependent and implemented differently for HCore and XCore targets.

There is also the global constant function pointer, which can be used to alter the Abort() behavior.


/* types */ 

using AbortMsgFuncType = void (*)(StrLen str) ;

/* global const AbortMsgFunc */ 

extern const AbortMsgFuncType AbortMsgFunc;

You may link an object file in your project with this constant defined to introduce a hook in Abort(). Be reasonable with hook actions: on XCore targets it may be called in any context, so you cannot do any "heavy" job inside. The same is true on HCore targets: use it just to show or log a message (using MessageBox(), for example).