Top
NetCOBOL V11.0 Debugging Guide
FUJITSU Software

5.6.2 Resources used by the COBOL Error Report

This section focuses on the programs and resources the COBOL Error Report uses to generate diagnostic reports.

5.6.2.1 Programs

For application errors and runtime messages of U-level errors, the COBOL Error Report is enabled while the COBOL runtime environment is open. Hence, the COBOL Error Report works on the following kinds of programs:

(Only those programs that run during the lifetime of the COBOL runtime environment, from opening to closing.)

Since the COBOL Error Report maintains user resource compatibility, you can use it without having to recompile and relink old resources.

5.6.2.2 Relationships between compiler and linkage options and output information

There are no special constraints on creating programs to be the object of the COBOL Error Report. The COBOL Error Report will generate a diagnostic report on any program as long as it is a COBOL program. The coverage of information in the diagnostic report, however, varies with each combination of compiler and linkage options specified. A summary of the correspondence between the possible combinations of compiler and linkage options and output information in the diagnostic report is given in "Table 5.3 Relationships between COBOL programs and output information".

Table 5.3 Relationships between COBOL programs and output information

Step

Details

[1]

[2]

[3]

[4]

[5]

[6]

Compiling

Specification of the TEST option

No

No

Yes

Yes

Yes

Yes

Linkage

Specification of the /DEBUG options

No

Yes

No

No

Yes

Yes

Execution

Availability of a debugging information file

No

No

No

Yes

No

Yes

Diagnostics

Information level

Export name + Offset

Yes

Yes

Yes

Yes

Yes

Yes

Symbol name + Offset

No

Yes

No

No

Yes

Yes

Program name + Line number

No

No

No

No

No

Yes

For details about export and symbol names, refer to "Export relative position" and "Symbol relative position" of "5.6.4.2.1 For application errors, runtime messages, and no response".

The level of information output to the diagnostic report is determined by the compilation, linkage, and run conditions.

For example, if no option is specified at compilation and linkage (conditions of column [1]), information of the "Export name + Offset" level will be output to the diagnostic report.

If COBOL language-level information such as the program name and line number is output to the diagnostic report, statements that cause problems can be easily identified. Therefore, it is recommended that options be specified at compilation and linkage and that applications be executed where the COBOL Error Report can access the debugging information file (conditions of column [6]).

When the COBOL Error Report can output information to the language-level, items of information are generated in the form of the following examples.

Example

Output example: In case of [6] in "Table 5.3 Relationships between COBOL programs and output information"

Module File : D:\APL\SAMPDLL2.dll
Section Relative Position : .text+0000025D
Export Relative Position : SAMPDLL2+00000229
Symbol Relative Position : SAMPDLL2+0000025D
Compilation Information : ASCII, SINGLE THREAD, NOOPTIMIZE
External Program/Class : SAMPDLL2
Source File : SAMPDLL2.cob
Source Line : 35

The COBOL Error Report will not generate language-level information when it examines the following kinds of programs but will still generate the export and symbol names and their offsets from the beginning:

The export name, the symbol name, and the offset from each head are generated in the form of the following examples.

Example

Output example: Only the export name and the offset (In case of [1][3][4] in "Table 5.3 Relationships between COBOL programs and output information")

Module File : D:\APL\SAMPDLL2.dll
Section Relative Position : .text+0000025D
Export Relative Position : SAMPDLL2+00000229

Output example: Symbol name and offset (In case of [2][5] in "Table 5.3 Relationships between COBOL programs and output information")

Module File : D:\APL\SAMPDLL2.dll
Section Relative Position : .text+0000025D
Export Relative Position : SAMPDLL2+00000229
Symbol Relative Position : SAMPDLL2+0000025D

Since export and symbol names each represent a compilation unit, they can easily be identified without needing language-level information output at execution time.

At this level, an object program listing is required to locate problems. The object program listing is created when the compiler options LIST and PRINT are specified at compilation. Refer to "LIST (Determines whether to output the object program listings)" and "PRINT (Whether compiler listing should be output and the output destination specification)" in the "NetCOBOL User’s Guide."

An example of an object program listing is shown below. A summary method of locating problems from export and symbol name relative offsets is described below.

       ADDR       OBJECT CODE  LABEL   INSTRUCTION              
                                                                
       BEGINNING OF SAMPDLL2                                    
(1) -> 00000000 31                   db      0x31               
       00000001 08                   db      0x08               
       00000002 53414D50444C4C32     dc      "SAMPDLL2"         
       0000000A 08                   db      0x08               
       0000000B 4E6574434F424F4C     dc      "NetCOBOL"         
       00000013 07                   db      0x07               
       00000014 XXXXXXXXXXXX         dc      "XXXXXX"           
       0000001B XXXXXXXXXXXXXXXX     dc      "XXXXXXXX"         
       00000023 XXXXXXXXXXXXXXXX     dc      "XXXXXXXX"         
       0000002B 2B30303030           dc      "+0000"            
       00000030 2031                 dc      " 1"               
       00000032 0000                 dc      0x0000             
       00000034                 PROLOGUEAD:                     
       00000034 XXXXXXXX             db      0xXXXXXXXX : PLB.1
(2) -> 00000038                 _SAMPDLL2:                      
       00000038 55                   push    ebp                
       00000039 8BEC                 mov     ebp,esp            
       0000003B 81ECB0000000         sub     esp,000000B0       
       00000041 8BD7                 mov     edx,edi            
       00000043 8BFD                 mov     edi,ebp            
       00000045 81EF54000000         sub     edi,00000054       
          :

A symbol name + offset 0 are located at [1] in the list above. Symbol name relative offsets, therefore, match the output offsets in the object program listing. Given a symbol name relative offset and an object program listing, problems can be easily located.

An export name + offset 0 are located at [2] in the list. Knowledge of the differences between [1] and [2] is essential to locating problems from an object program listing on the basis of export name relative offsets. In this example, an export name relative offset plus 38 (hexadecimal) matches the offset in the object program listing.

5.6.2.3 Compiling and linking programs

To allow the COBOL Error Report to generate language-level information, it is necessary to specify an option when compiling and linking programs.

The compiler options that are specified at program compile time are described below.

(Use of the compiler Visual C++ is assumed for this example, for non-COBOL programs.)

COBOL programs:  TEST
C/C++ programs: There is no compiler option to specify for the COBOL Error Report

Specify the compiler option TEST to compile COBOL source programs. If TEST is specified, the compiler generates information in the object file for use by the COBOL Error Report and creates a debugging information file at the same time. The debugging information file is named after the COBOL source file name with its extension changed to SVD.

The compiler option OPTIMIZE may be specified together with the compiler option TEST to direct optimization. The debugging information file created when both TEST and OPTIMIZE are specified is smaller than that created when only TEST is specified, because the amount of information written to the debugging information file is limited by both compiler options TEST and OPTIMIZE.

Note

The debugging information file created by having the compiler option OPTIMIZE specified cannot be used with the interactive debugger.

Please do not specify compiler option /Oy when you compile the C/C++ source programs. Information necessary for the investigation from <Call Stack> or <Stack Summary> of the diagnostic report is not obtained when compiler option /Oy is specified. Please note that compiler option /Oy might be enabled by specifying compiler option /Ox (full optimization), /O1 (optimization of the program size), and /O2 (optimization of the execution speed).

The linkage options specified at program linkage time are shown below.

/DEBUG

Specify the linkage option /DEBUG to link object files of COBOL and non-COBOL programs. When these options are specified, the linker directs the information generated by the compiler in the object file to an executable file or dynamic link library file.

To link the object file of the COBOL Error Report, specify the linkage option /DEBUG.

The object program of the COBOL Error Report can be easily made by using the project management function. For more information, refer to "Creating a Debug Module" in the "NetCOBOL User's Guide".

When it is necessary to debug programs which link with the non-COBOL programs by using Visual C++, specify the linkage option /DEBUG. For details about other language products, refer to the manuals for those products.

Information

Given an object program listing and a symbol name relative offset, problems can be easily located. The specification of the linkage option /DEBUG is recommended for this purpose.

5.6.2.4 Location of the debugging information file (.SVD)

To allow the COBOL Error Report to generate the language-level information, it is necessary to store the debugging information file made with COBOL compiler in the same folder as an executable file and the dynamic link library.

Store the debugging information file in the operation machine together with an executable file and the dynamic link library when you use the COBOL Error Report by operating environment. When the debugging information file does not exist, the COBOL Error Report outputs the assembler-level information composed of export name, symbol name and offset. Refer to "5.6.2.2 Relationships between compiler and linkage options and output information" for output information on the COBOL Error Report.