Defines | |
#define | HEL_ASSERT(expression, message) |
Assertion evaluation mechanism. | |
#define | HEL_SASSERT(expression) |
Static assertion evaluation mechanism. | |
Functions | |
HEL_API void ATTR_NOINSTRUMENT | hel_DebugSetOnAssert (PDebugAssertFunc pFunc) |
Specify a function that gets called before an assertion takes place. |
HEL
provides an easy to use mechanism to set program execution breakpoints, which are automatically turned off when you switch to releasemode. Please note that these breakpoints are currently only supported by NO$GBA emulator and must be explicitly turned on!
Using such a breakpoint is easy, all you need is HEL_DEBUG_BRK
Example:
The following example shows how to stop the program execution using HEL_DEBUG_BRK
macro:
static void ATTR_NOINLINE ATTR_USED DummyFunction() { } int main(void) { ham_Init(); // Stop program execution! HEL_DEBUG_BRK; DummyFunction(); for(;;) { // Infinite loop } return 0; }
The program execution is stopped after ham_Init
and before DummyFunction
gets called. NO$GBA halts at this point and displays the sourcecode in its debugger-window:
HEL's
breakpoint implementation with another emulator than NO$GBA, it will just leave the corresponsing opcode away, assuming you specified what emulator you use (see Debug Message Output) and therfore will not halt at the breakpoint.#define HEL_ASSERT | ( | expression, | |||
message | ) |
Assertion evaluation mechanism.
The HEL_ASSERT mechanism evaluates an expression and, when the result is FALSE
, displays an error screen and aborts the program execution until you press a specific button. The error-screen displays several informations where in the source the assertion failed. This includes:
[in] | expression | Expression that evaluates to TRUE or FALSE |
[in] | message | Message to display when expression is FALSE |
FALSE
only when the program is operating incorrectly.HEL_DEBUG
and HEL_CHECKED
versions. #define HEL_SASSERT | ( | expression | ) |
Static assertion evaluation mechanism.
The HEL_SASSERT macro can be used to evaluate an expression at compile time.
[in] | expression | Expression that evaluates to TRUE or FALSE |
HEL_DEBUG
, HEL_CHECKED
and in release mode.
HEL_API void ATTR_NOINSTRUMENT hel_DebugSetOnAssert | ( | PDebugAssertFunc | pFunc | ) |
Specify a function that gets called before an assertion takes place.
You can specify a function that gets called before an assertion takes place. This can be helpful if you want to output your engine stats or whatever when something went wrong. Use the hel_DebugSetOnAssert function for this.
[in] | pFunc | A pointer to the function that should be called before an assertion takes place |