How to Enable Debugging for AI Script Projects
The debugging mode can be useful for problem analysis. It offers you an easy way to analyze your problems, to step through your code parts and to support external Java libraries.
The following steps are necessary to enable the debug mode:
- Navigate to the DaVinCiCFG.exe folder
- Create a batch file for CFG5 debug mode startup
- Create a new text document in this folder.
- Name it e.g. StartCFG5WithDebugging.bat (attention a change of the file ending is necessary).
- Open the new created file with a text editor (e.g. Notepad++).
- Enter the needed commands to start configurator in debug mode.
start D:\SIPS\CurrentUsedSip\external\DaVinciConfigurator\Core\DaVinciCFG.exe --enableDebugger 8001
- Additionally you can add a project, which will be automatically opened after the start of CFG5. You can do this by adding the following parameter:
- Both paths can be relative or absolut.
- Start CFG5 in debug mode
- Right click on the new created .bat file and open it.
- CFG5 will open in the debug mode.
- Start the debug mode in IntelliJ
- Open IntelliJ with your script project.
- Edit your run configurations
- Click Apply and close the dialog.
- Then choose the IntelliJ debug mode and start it.
- Understanding the interaction between IntelliJ and CFG5
- Start CFg5 in debug mode.
- Start your script project as described in point 4 with debug.
- Set a break point in your script project.
- Start the script in CFG5.
- You can now see that the script holds at your break point.
- In the debugger console you have now several options:
- i.e. you can step over the break point,
- you can step into it or
- you can just resume the program and continue with the execution.
- When the script is finished you can see this in the console in CFG5.
- Understanding the continuous build mode of IntelliJ
- If not already started, start CFG5 in debug mode.
- Instead of running the script project in IntelliJ, in build more or in debug mode, start it in continuous build mode.
- Change something in your script project, e.g. add a println or change a println.
- Saving the changes will now automatically build the script, so there is no need to build it manually.
- After saving you can execute the changed script in the CFG5 and the changes will be executed.