Debugging Using a Core Dump

Important:
  • The following applies to native code only.
  • On Windows, the core dump files created by this product are Microsoft minidump files. If you have a mixed-language application, you can use the minidump file to debug the other languages involved.

When an application crashes, you can arrange for its state to be saved to disk, in a core dump file, which can indicate where the error occurred in the source code, the contents of memory at the time of the error, and the values of any variables and expressions set at the time. You can then use the core dump file to help debug the problems.

Core dump debugging is useful when you have a failing application in a production environment, and you don't have the COBOL development system installed. As long as you have access to the application's source files elsewhere, you can produce a core debug file and utilize it.

To accurately debug using a core dump file, in your development environment, you must use the original source and .idy files used to create the executable in question, or failing that, you must ensure that the sources are in the same state (directive settings, optimization, etc..) as they were during the initial build. Also, as this process will most likely result in you moving from a production environment on one machine, to a development environment on another, any supporting files used by the application must be installed along the same path in both environments.

If you do not have the required .idy file, the IDE indicates that no source is available.

Produce a core dump file

You can produce a core dump file in one of the following ways:

  1. Copy the file cblcored.exe from the bin subfolder in the product installation directory to the same directory as your application's main executable file.
  2. At the command line, go to the directory containing cblcored.exe and type:
    cblcored
    Note: cblcored.exe requires write permission to the current user’s HKEY_CURRENT_USER key in the Windows registry. Ensure that the utility has the required permission in order for any changes to the Core Dump settings to persist.
  3. From the Core Dump list, select one of the following:
    • Enabled with prompt if you want a message box displayed when a core dump is about to be created.
    • Enabled with no prompt if you do not want a message box displayed when a core dump is about to be created.
    • Disabled if you do not require a core dump.

    If you have selected one of the enabled options, the next time you run the application and an error occurs, the state of the application at the time of the error is saved in the file cblcore. This file is saved in the same folder as the application.

Alternatively, you can configure the system so that it produces a core dump for run-time errors. To do this:

  1. Create a run-time tunable configuration file and add to it the core_on_error tunable.

    The default name of the core dump file to be produced is cblcore. To specify a different file name, add the core_filename tunable to the run-time tunable configuration file.

  2. Run the application. When the application crashes, a core dump is produced.

Debug using a core dump file

To debug a core dump file using a native COBOL project:

Note: Ensure that the project and the sources it compiles have not changed since the original executable was created; otherwise, any discrepancies in the .idy file used to debug and the one originally created (when the executable was built) will cause unexpected results during debugging.
  1. In the IDE, click Project > MyProject Properties and navigate to the Debug tab.
  2. Click Start external program and specify the name of the Micro Focus core dump file.
Note:
  • It is not possible to enable both Just-In-Time Debugging and Core Dump concurrently.
  • To debug a 64-bit core dump you must first create a 64-bit project configuration or select x64 as the Platform target on the COBOL tab in the project's properties.
  • cblcored.exe is one of the COBOL Server files, which is provided for on-site debugging. You are authorized to redistribute this file to your customers providing you have the appropriate license.
  • To create a core dump for an application running under IIS, the application must be run in the same user account as that being used when enabling the core dump feature. For example, a core dump will not be produced for a CGI or ISAPI application running under the default anonymous logon account.