Visible to Intel only — GUID: GUID-B8D77890-54DC-4FB9-BD1E-6C55CC8F03DF
Visible to Intel only — GUID: GUID-B8D77890-54DC-4FB9-BD1E-6C55CC8F03DF
Finding and Reporting Out-of-Bounds Errors
The pointer checker is not supported on macOS systems.
The pointer checker includes the __chkp_report_control() library function and the __chkp_report_option_t enumeration to allow you to control how errors are reported. The function and enumeration are declared in the header file chkp.h.
The report control enumeration has one of the following values:
Enum Value | Action |
---|---|
__CHKP_REPORT_NONE |
Do nothing. |
__CHKP_REPORT_BPT |
Execute a breakpoint interrupt. If you specify this value, the pointer checker will issue a breakpoint for any out-of-bounds error that it finds. If you are using a debugger, the breakpoint will trap into the debugger so that you can determine where the error occurred. You can then use the features of the debugger to determine the cause of the error. |
__CHKP_REPORT_LOG |
Log the error and continue; the compiler will report each out-of-bounds pointer it finds. |
__CHKP_REPORT_TERM |
Log the error and exit the program; the compiler will only report the first bounds violation and then terminate. |
__CHKP_REPORT_CALLBACK |
Call a user defined function; the compiler will invoke a user-defined function to deal with a bounds error. |
__CHKP_REPORT_TRACEBACK _BPT |
Print a traceback including source file and line number for the instruction where the out-of-bounds error occurred, then execute a breakpoint interrupt.
NOTE:
Specify the traceback compiler option to obtain better traceback information, including routine names. |
__CHKP_REPORT_TRACE_LOG |
Log the error and continue; the log will include traceback information for each out-of-bounds error. This is the default reporting mode.
NOTE:
Specify the traceback compiler option to obtain better traceback information, including routine names. |
__CHKP_REPORT_TRACE_TERM |
Log the error and terminate; the log will include traceback information for each out-of-bounds error. Only the first bounds error will be reported.
NOTE:
Specify the traceback compiler option to obtain better traceback information, including routine names. |
__CHKP_REPORT_TRACE_CALLBACK |
Log the error and call a user-defined routine; the log will include traceback information for each out-of-bounds error.
NOTE:
Specify the traceback compiler option to obtain better traceback information, including routine names. |
__CHKP_REPORT_OOB_STATS |
Emit statistics for the bounds violation; Currently, this is a count of the out-of-bounds errors. |
__CHKP_REPORT_USE_ENV_VAR |
Use the environment variable INTEL_CHKP_REPORT_MODE to specify the reporting mode. If the environment variable is not set, the default reporting mode is used. |
Changing the Reporting Mode
To change the reporting mode from the default __CHKP_REPORT_TRACE_LOG:
Include chkp.h in your program source.
Add a call to the report control routine __chkp_report_control() (before any pointer references are made), specifying one of the enum values.
For example, to report all bounds errors, specify the following:
__chkp_report_control(__CHKP_REPORT_LOG, 0);
In the above, the first parameter to the routine is the enum value and the second parameter is 0, except in the case of the __CHKP_REPORT_CALLBACK enum value, which requires the name of a user-defined callback routine as the second parameter.
You can also change the reporting mode using the environment variable INTEL_CHKP_REPORT_MODE. This allows you to change the reporting mode without recompiling your code. To use the environment variable, do the following:
Add an include of chkp.h in your program source.
Add a call to the report control routine __chkp_report_control() (before any pointer references are made), specifying __CHKP_REPORT_USE_ENV_VAR.
Set the INTEL_CHKP_REPORT_MODE environment variable to the desired report mode. For example:
export INTEL_CHKP_REPORT_MODE=__CHKP_REPORT_OOB_STATS
The INTEL_CHKP_REPORT_MODE environment variable is valid only if a call to __chkp_report_control has been made with the report mode set to __CHKP_REPORT_USE_ENV_VAR. Otherwise, it is ignored.
If you specify the report mode to be __CHKP_REPORT_USE_ENV_VAR and the INTEL_CHKP_REPORT_MODE environment variable is not set, the default report mode (__CHKP_REPORT_TRACE_LOG) is used.