Previous Topic Next topic Print topic


Debugging a CGI Application

You can debug a CGI applications using the Just-In-Time Debugger with an embedded call to CBL_DEBUGBREAK, or using the COBOL Wait for Application Attachment debug configuration.

Tip: If the Debugger fails to find the symbols for your program, you can add the path to the CGI symbols to your symbol path. Do this by adding it to the Debug Symbols Lookup Path list in your debug configuration.

Debug using COBOL Wait for Application Attachment debug configuration

  1. Start your Web server.
  2. Configure Apache so that the cgi-bin directory points to the Eclipse build output directory.
  3. Ensure the CGI binaries are in a folder on the Web server and execution of CGIs in that folder is enabled.
  4. Start Eclipse.
    • If the CGI is running as a service, you must start Eclipse with administrator's privileges.
    • You can use the httpd executable to run the Apache Web Server from the command line. Since this executable uses your own User ID, it is not necessary to start the IDE with administrator's privileges.
  5. In Eclipse, select a COBOL Wait for Application Attachment debug configuration.
  6. Under Matching Option, select the Executables stored in directory and specify the build Output Path as defined in the project properties.
  7. Start debugging.
  8. Start a Web browser and enter a URL that will invoke the CGI executable.

Debug using CBL_DEBUGBREAK and the Just-In-Time debugger

You can also embed a call to CBL_DEBUGBREAK in your code and use it to debug CGIs.

You should start the IDE as described above but for the COBOL Wait for Application Attachment debug configuration, under Matching Option, select Any.

Debug using CBL_DEBUG_START

You can debug the CGI by embedding a call to CBL_DEBUG_START in your code and specifying the program identifier in the CBL_DEBUG_START statement.

You should start Eclipse as described above but for the COBOL Wait for Application Attachment debug configuration, under Matching Option, select Program Identifier.

This approach enables you to have more than one debug sessions attached to the same process.

Previous Topic Next topic Print topic