Debug #pragmas

Top  Previous  Next

#pragmas with the class name debug control the amount of additional information produced by the code-generator to assist debugging programs.

The following debug #pragmas are available.


#pragma debug(line_num => on | off)

#pragma debug(proc_trace => on | off)

#pragma debug(public => on | off)

#pragma debug(vid => off | min | full)


A pragma can be used in the Project language, C++ code, Modula-2 code, or Clarion code. Some only work in certain places. A ‘P’ to the right of the pragma indicates it can be used in the Project language, a ‘C’ indicates it can be used in C++ code, a ‘M’ indicates it can be used in Modula-2 code, and a ‘W’ indicates that it can be used in Clarion code (CLW files).


#pragma debug(vid => off | min | full)    cpmw

When full, the compiler places information for the SoftVelocity Visual Interactive Debugger (VID) into a .DBD file. Use this option when debugging your program with the SoftVelocity debugger.


 This #pragma disables the register usage and stack frame optimizations, allowing full access to variables within the debugger. All local variables are treated as volatile, to ensure that their values are not held in registers across statements, thus ensuring that the debugger can access their values at all times.

When min, the compiler performs the optimizations described above, and does not treat local variables as volatile. The debugger can still be used, but cannot reference local variables and some stack frames.

When off, the compiler generates no debugger information, thus speeding compile, generating the best possible code, and saving disk space. The default setting is off.


#pragma debug(proc_trace => on | off)   pmw

When this #pragma is on, the compiler generates instructions to call the procedures EnterProc and ExitProc on, respectively, entering and exiting every procedure. These procedures can then perform any procedure tracing you may require.


 You should ensure that this #pragma is off for the EnterProc and ExitProc procedures themselves, otherwise infinite recursion will occur and your program will undoubtedly crash.

The two procedures must be visible to the module in which proc_trace is set on. This means that the module itself must define the procedures ExitProc and EnterProc or the module must specifically import them using an unqualified import.

The default setting is off.


#pragma debug(line_num => on | off)   cpmw

This #pragma causes the compiler to generate line number information for debuggers such as symdeb. This information is stored in object files and printed in the map file. The default setting is off.


#pragma debug(public => on | off)    cpm

This causes private objects to be made public to facilitate the use of debuggers such as symdeb. It may cause duplicated public warnings at link-time in languages such as C and C++ which do not have a modular structure. These warnings may be safely ignored, although it is recommended that such procedures should be renamed to avoid possible confusion. The default setting is off.