Restriction: This topic applies to native COBOL only.
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:
- Start
Eclipse as an administrator.
- Add a call to CBL_DEBUGBREAK or CBL_DEBUG_START in the application.
- Create a COBOL Wait for Application Attachment debug configuration for your project.
- Start
a
COBOL Wait for Application Attachment debug session.
- When CBL_DEBUGBREAK or CBL_DEBUG_START is executed,
Eclipse starts debugging the service.
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 the Windows Service is not built in a project, you need to specify the path to the Service's
.idy files, and the Service must include calls to CBL_DEBUGBREAK or CBL_DEBUG_START:
- Start Eclipse as an administrator.
- Create a COBOL Wait for Application Attachment debug configuration.
- On the
Debug Symbols tab of the configuration, click
Add, select
File System Directory and then click
OK.
- Click
Browse and navigate to and select the directory on your machine that includes the application’s
.idy files, then click
OK.
- Click
Debug in the
Debug Configurations dialog box.
This starts a debugging session and the COBOL Debugger is waiting for an attachment.
- Execute your Windows Service.
- 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
- Enable Just-in-time debugging from
Windows > Preferences > Micro Focus > COBOL > Debug.
- Add a call to CBL_DEBUGBREAK in the application.
When the CBL_DEBUGBREAK is executed, Eclipse is launched and starts debugging the application.