Previous Topic Next topic Print topic


Debugging Windows Services

To debug a Windows service you must be logged on to the console of the computer running the service.

You can debug the service either using library routines or using JIT debugging.

Using Library Routines

If you are using an Eclipse project to build the Windows Service:

  1. Start Eclipse as an administrator.
  2. Add a call to CBL_DEBUGBREAK or CBL_DEBUG_START in the application.
  3. Create a COBOL Wait for Application Attachment debug configuration for your project.
  4. Start a COBOL Wait for Application Attachment debug session.
  5. When CBL_DEBUGBREAK or CBL_DEBUG_START is executed, Eclipse starts debugging the application.

    If you use CBL_DEBUG_START you can then use CBL_DEBUG_STOP to detach the debugger from the application, which resumes running without the debugging features.

If you do not have the project that builds the Windows Service, you need the Service's .idy files, and the Service must include calls to CBL_DEBUGBREAK or CBL_DEBUG_START:

  1. Start Eclipse as an administrator.
  2. Create a COBOL Wait for Application Attachment debug configuration.
  3. On the Debug Symbols tab of the configuration, click Add, select File System Directory and then click OK.
  4. Click Browse and navigate to and select the directory on your machine that includes the application’s .idy files, then click OK.
  5. Click Debug in the Debug Configurations dialog box.

    This starts a debugging session and the COBOL Debugger is waiting for an attachment.

  6. Execute your Windows Service.
  7. When CBL_DEBUGBREAK or CBL_DEBUG_START is executed, Eclipse starts debugging the application.

    If you use CBL_DEBUG_START, you can then use CBL_DEBUG_STOP to detach the debugger from the application, which resumes running without the debugging features.

Using JIT Debugging

  1. Enable Just-in-time debugging from Windows > Preferences > Micro Focus > COBOL > Debug.
  2. Add a call to CBL_DEBUGBREAK in the application.

    When the CBL_DEBUGBREAK is executed, Eclipse is launched and starts debugging the application.

Previous Topic Next topic Print topic