#pragma ibm snapshot

Description

The #pragma ibm snapshot allows the user to specify a location at which a breakpoint can be set and to define a list of variables that can be examined when program execution reaches that location.

Syntax

Read syntax diagramSkip visual syntax diagram                               .-,-------------.
                               V               |
>>-#--pragma--ibm snapshot--(----variable_name-+--)------------><

where variable_name is a collection of variables. Class, structure, or union members cannot be specified.

Notes

This pragma is provided to facilitate debugging optimized code produced by the XL C/C++ compiler. During a debugging session, a breakpoint can be placed on this line to view the values of the named variables. When the program has been compiled with optimization and including the option -g, the named variables are guaranteed to be visible to the debugger.

Snapshot does not consistently preserve the contents of variables with a static storage class at high optimization levels.

Variables specified in #pragma ibm snapshot should be considered read-only while being observed in the debugger, and should not be modified. Modifying these variables in the debugger may result in unpredictable behavior.

Example

#pragma ibm snapshot(a, b, c)

If a breakpoint is set through the debugger at this point in a program, the values of variables a, b, and c should be visible.

Related information