File IPNWB_Debugging.ipf¶
Holds functions for debugging.
Functions
-
variable ASSERT_TS(variable var, string errorMsg)¶
Low overhead function to check assertions (threadsafe variant)
Example usage:
ASSERT_TS(DataFolderExistsDFR(dfr), "MyFunc: dfr does not exist") do something with dfr
Unlike ASSERT() this function does not print a stacktrace or jumps into the debugger. The reasons are Igor Pro limitations. Therefore it is advised to prefix
errorMsg
with the current function name.- Parameters:
var – if zero an error message is printed into the history and procedure execution is aborted, nothing is done otherwise.
errorMsg – error message to output in failure case
-
variable DEBUGPRINTv(variable var, string format = defaultValue)¶
Output debug information and return the parameter var.
Debug function especially designed for usage in return statements.
For example calling the following function
will outputFunction doStuff() variable var = 1 + 2 return DEBUGPRINTv(var) End
to the history.DEBUG doStuff(...)#L5: return value 3
- Parameters:
var – numerical argument for debug output
format – optional format string to override the default of “%g”
-
string DEBUGPRINTs(string str, string format = defaultValue)¶
Output debug information and return the parameter str.
Debug function especially designed for usage in return statements.
For example calling the following function
will outputFunction/s doStuff() variable str= "a" + "b" return DEBUGPRINTs(str) End
to the history.DEBUG doStuff(...)#L5: return value ab
- Parameters:
str – string argument for debug output
format – optional format string to override the default of “%s”
-
variable DEBUGPRINT(string msg, variable var = defaultValue, string str = defaultValue, string format = defaultValue)¶
Generic debug output function.
Outputs variables and strings with optional format argument.
Examples:
DEBUGPRINT("before a possible crash") DEBUGPRINT("some variable", var=myVariable) DEBUGPRINT("my string", str=myString) DEBUGPRINT("Current state", var=state, format="%.5f")
- Parameters:
msg – descriptive string for the debug message
var – variable
str – string
format – format string overrides the default of “%g” for variables and “%s” for strings
-
variable DEBUG_TIMER_START()¶
Start a timer for performance measurements.
Usage:
variable referenceTime = DEBUG_TIMER_START() // part one to benchmark DEBUGPRINT_ELAPSED(referenceTime) // part two to benchmark DEBUGPRINT_ELAPSED(referenceTime)
-
variable DEBUGPRINT_ELAPSED(variable referenceTime)¶
Print the elapsed time for performance measurements.
See also
-
variable EnableDebugMode()¶
Enable debug mode.
-
variable DisableDebugMode()¶
Disable debug mode.
-
variable DEBUG_STOREFUNCTION()¶
Variables
-
static const string functionReturnMessage = "return value"¶