int main() { int* integer; userAssert(integer, "assertion!!\n"); printf("clear assertion\n"); return 0; }
/* 1) This function will disable all interrupts to prevent any new * interrupts to execute which can trigger another assert causing a * very confusing situation of why it failed. */ void dbgAssert( const PORT_C_ROM struct dbgCobj * cObj, const PORT_C_ROM char * expr, enum esDbgMsg msg) { struct esDbgReport dbgReport; const char * msgText; switch (msg) { case ES_DBG_OUT_OF_RANGE : { msgText = "Value is out of valid range"; break; } case ES_DBG_OBJECT_NOT_VALID : { msgText = "Object is not valid"; break; } case ES_DBG_POINTER_NULL : { msgText = "Pointer has NULL value"; break; } case ES_DBG_USAGE_FAILURE : { msgText = "Object usage failure"; break; } case ES_DBG_NOT_ENOUGH_MEM : { msgText = "Not enough memory available"; break; } default : { msgText = "Unknown error has occurred"; break; } } dbgReport.modName = cObj->mod->name; dbgReport.modDesc = cObj->mod->desc; dbgReport.modAuthor = cObj->mod->auth; dbgReport.modFile = cObj->mod->file; dbgReport.fnName = cObj->fn; dbgReport.expr = expr; dbgReport.msgText = msgText; dbgReport.line = cObj->line; dbgReport.msgNum = msg; userAssert( &dbgReport); }