SophiaFramework UNIVERSE 5.3 |
Table 27.1. Macro for Diagnosing
Macro | Description |
---|---|
TRACE | Display the messages for debugging in the BREW Output window. |
ASSERT | Display an alert message in the BREW Output window if the evaluated value of specified argument is false. (The specified argument will not be evaluated if the application is built for the BREW device.) |
VERIFY | Display an alert message in the BREW Output window if the evaluated value of specified argument is false. (The specified argument is always evaluated even if the application is built for the BREW device.) |
Caution | |
---|---|
The macros for diagnosing are valid only when the TARGET_BUILD_DEBUG macro is defined. |
To display the messages for debugging in the BREW Output window, use the TRACE macro.
If the TARGET_ENVIRONMENT_SIMULATOR macro is defined, the TRACE macro is replaced with SFXHelper::dbgprintf (BREW helper function: DBGPRINTF).
SInt16 ComplicatedCaculation(SInt16 data); Void Evaluate(Void) { SInt16 val = 0; ... // "val" will be changed during processing SInt16 result = ComplicatedCalculation(val); TRACE("result = %d (in Evaluate, Line = %d)", result, __LINE__); ... }
Note | |
---|---|
The return value of ComplicatedCaculation function and the current line of source code are displayed on the BREW Output window. |
If the TARGET_ENVIRONMENT_SIMULATOR macro is not defined | |
---|---|
The TRACE macro is defined to be "empty". Therefore, be careful about the TRACE macro when assigning the value to its arguments or calling the function that will change the value of member variable. |
The ASSERT macro which has only one argument of Bool type is used during development to verify the condition that must be always satisfied. (The behaviour of application build for BREW Simulator might be different from that for the BREW device.)
If the TARGET_ENVIRONMENT_SIMULATOR macro is defined(if build for the BREW Simulator), when the evaluated value of specified argument is false, alert messages with the source file name and the line number will be displayed on the BREW Output window.
// Example.cpp SFMTYPEDEFCLASS(MyClass) class MyClass{ public: Initialize(Void); ... }; ... // here is line 4093 Void Function(MyClassConstPtr obj) { ASSERT(obj != null); // verify that argument value of Function is not NULL obj->Initialize; ... } ...
Note | |
---|---|
Make sure that obj is not the null pointer.
If obj is the null pointer, the following alert message will be displayed on the BREW Output window.
ASSERT failed: line 4096, file 'Example.cpp' |
If the TARGET_ENVIRONMENT_SIMULATOR macro is not defined(if build for the BREW device) | |
---|---|
The ASSERT macro is defined to be "empty". Therefore, be careful about the ASSERT macro when assigning the value to its arguments or calling the function that will change the value of member variable. |
Others | |
---|---|
The ASSERT macro only displays the alert messages if the evaluated value of specified argument is false, and execution processing never stop at this macro. |
The VERIFY macro which has only one argument of Bool type is used during development to verify the condition that must be always satisfied. (The behaviour of application build for BREW Simulator is the same as that for the BREW device.)
If the TARGET_ENVIRONMENT_SIMULATOR macro is defined(if build for the BREW Simulator), when the evaluated value of specified argument is false, alert messages with the source file name and the line number will be displayed on the BREW Output window.
If the TARGET_ENVIRONMENT_SIMULATOR macro is not defined(if build for the BREW device), only the value of argument are evaluated.
Note | |
---|---|
The VERIFY macro is the same as ASSERT, except that the argument of Bool type is evaluated if the TARGET_ENVIRONMENT_SIMULATOR macro is not defined, |
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |