Source path remapping is necessary if the SIMATIC AX app has been built (and downloaded) from a location other than the current project location. This can apply when cloning a repository from a git repository while the program is already running on a PLC.
The steps in compiling a SIMATIC AX app include generating debug information as well as building the binaries. This debug information essentially maps symbols in ST to physical locations on the PLC. It also includes paths to the build directory and is downloaded to the PLC with the binaries via the sld.
If the location of the project has changed, the paths contained in the debug information will no longer be valid and the old and new paths will need to be provided to the debugger.
Here is an example:
- The project is built and downloaded
Example location: C:\ax-debugging-example - The project is copied to a different location
Example location: C:\ax-source-path-remapping - The debugger is started with the new build project and the new debug information
The parameters--baseFolderand--remappingPathare used to modify the debug information
There are two possibilities for: On-connect and during runtime.
On-connect
Connect the debugger from the new location to a PLC downloaded with the old location:
apax sdb --targetIP 192.168.0.1 --password aSecurePassword --certificate ./cert.cer --baseFolder C:\ax-debugging-example\src --remappingPath C:\ax-source-path-remapping\src
The parameter --baseFolder must contain the old location.
The parameter --remappingPath must contain the new location.
The debugger can now be used in the usual way.
During runtime
In this case the debugger is already connected to the PLC. The following command will effect source path remapping during runtime:
set source-map C:\ax-debugging-example\src C:\ax-source-path-remapping\src