Error analysis with core dump

A core dump is a dump of the PLC project data.

Error analysis with core dump 1:

Available from TC3.1 Build 4024.11

Error analysis with core dump 2:

Core dump can only be used with the associated compile info file

If you archive or save a core dump file, please note that the associated project and associated compile info file (*.compileinfo file, which is stored, for example when creating the project, in the "_CompileInfo" folder) must be present in order to load a core dump. If this is not the case, TwinCAT cannot use the dump later.

Please also note here the setting options on the Settings tab. With the help of the Core Dump setting, you can configure whether the core dump file, which may be located in the project directory, is to be saved together with the available compile info files in a TwinCAT file archive.

Generating a Core Dump

1) Automatic generation

In case of an exception error, runtime systems automatically store a core dump on the target system if the associated PLC project is not currently logged in to a development environment. By default, this core dump is stored as a *.core file in the boot folder of the target system. Further information on the (adjustable) storage path can be found below. The automatic generation of a core dump also occurs if the exception error occurs within the code of an FB_init/FB_reinit/FB_Exit method (from TC3.1 Build 4024.25).

Error analysis with core dump 3:

Warning message when core dump is available on target system

If you login a PLC project and there is a core dump on the selected target system, a warning is displayed in the message window indicating that a core dump is available on the device.

If the warning is no longer to be displayed when logging in the project (e.g. because you have completed the analysis of this core dump file or because you have archived the file somewhere else), you can delete the respective core dump file from the target system.

2) Manual generation

In online mode, you can also explicitly generate a core dump if the PLC project is currently at a breakpoint or an exception has occurred. In this case TwinCAT stores the core dump file only in the project directory and not on the target system. The core dump file generated is saved directly in the PLC project directory (<PLC_project_name>.<PLC_project_GUID>.core).

Loading a core dump

You can load the core dump from the target system into the project directory in online mode (using the Command Generate core dump). In addition, you can load a core dump from the project directory into the project in offline mode (using the Command Load core dump). You will then receive an online view of the PLC project with the data and values at the time of the exception or at the time of generating the core dump file.

Error analysis with core dump 4:

In the online view that TwinCAT generates when loading the core dump into the project, menu commands appear as available that are not effective in this state. If you select such a command, you will receive a corresponding message.

In addition, you can only close the core dump view using the command Close core dump. The Logout command is not effective in this view.

Archiving

If the core dump file located in the project directory is to be contained in the project archive, activate the "Core Dump" option during the configuration of the file archive content (see documentation Reference User Interface > Project > PLC project settings > Settings tab).

Storage path for automatic creation

Error analysis with core dump 5:

Available from TwinCAT 3.1 Build 4026

Default:

By default, automatically generated core dumps are stored as *.core files in the boot folder of the target system. By default, this is located at:

Individual adjustment:

If desired, the storage path of the automatic core dump creation can be adjusted. To do this, the desired storage path must be entered in the Windows registry of the target system.

1. Open the following registry path on the target system:
2. If the "Plc" folder does not yet exist, add it.
3. Add the key "CoreDumpDir" as a string and enter the desired file path for the automatic core dump creation as the value.
4. Set TwinCAT in Config.
The path is activated the next time the TwinCAT state changes to Run.

Two exemplary workflows are described below.

Load core dump from target system to project for analysis

Requirement:

With the development environment, you have opened the project that produced an exception error on the target system. The PLC project is in online mode in the development environment.
1. Use the Command Generate core dump to load the core dump from the target system.
⇒ TwinCAT copies the core dump file with the name <PLC project name>.<PLC project GUID>.core into the local PLC project directory.
2. Log the PLC project out.
3. Use the Command Load core dump to load the desired core dump into the project.
⇒ TwinCAT displays an online view of the PLC project. You can see the variable values and call stack at the time of the error.
4. After completing the core dump analysis, select the Command Close core dump.
TwinCAT closes the core dump view of the PLC project. The development environment reappears with the views of normal offline operation.

Manual generation of a core dump of the logged-in PLC project

A PLC project is in online mode in the development environment. The PLC project is currently at a breakpoint or an exception error has occurred.
1. Select the Command Generate core dump.
TwinCAT generates a new core dump and creates the file with the name <PLC_project_name>.<PLC_project_GUID>.core in the local PLC project directory.

See also: