Debug Assertion


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.

Detailed Description

Pages:

Program execution breakpoints

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:

debug_brk0.png

Note:
If you use 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.
Requirements: NO$GBA shareware or full version. "Source Code Breakpoints" must be turned on in no$gba Xcept setup.

Define Documentation

#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:

Assertion Screen
assert_01.png
Assertion Screen displaying the call stack
assert_02.png
Parameters:
[in] expression Expression that evaluates to TRUE or FALSE
[in] message Message to display when expression is FALSE
Note:
The HEL_ASSERT macro is typically used to identify logic errors during program development by implementing the expression argument to evaluate to FALSE only when the program is operating incorrectly.
HEL_ASSERT works only in HEL_DEBUG and HEL_CHECKED versions.
See also:
hel_DebugSetOnAssert, Library Overview

#define HEL_SASSERT ( expression   ) 

Static assertion evaluation mechanism.

The HEL_SASSERT macro can be used to evaluate an expression at compile time.

Parameters:
[in] expression Expression that evaluates to TRUE or FALSE
Note:
HEL_SASSERT works in all HEL versions, HEL_DEBUG, HEL_CHECKED and in release mode.


Function Documentation

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.

Parameters:
[in] pFunc A pointer to the function that should be called before an assertion takes place


Generated on Sat Aug 12 13:54:08 2006 for HEL 2 Library by  doxygen 1.4.7