Debugger - archimatetool/archi-scripting-plugin GitHub Wiki
Using the Chrome Debugger to trace through your script
[!CAUTION] The Chrome Debugger in jArchi should only be used if you know what you are doing. Using it incorrectly can freeze Archi, requiring a force quit. Use at your own risk!
The Chrome Debugger is an experimental feature in Archi 1.9. It allows you to trace through the execution of your script one line at a time in a supported browser and to set breakpoints.
Pre-requisites
- Windows or Mac. Due to technical issues, Linux is not supported.
- A Chrome based browser such as Google Chrome or MS Edge installed
- Archi 5.5 or later
- jArchi version 1.9 or later
Enabling
- To enable debugging open Archi's Preferences/Settings and find the "Scripting" pane, then check "Enable Chrome Debugging".
- The default port is set to
9229
. You can change this if you like but this one should work for most cases. - Set the path to the Chrome/Edge browser application. On Mac this will ensure that the browser is automatically opened and the
devtools://
URL is set to go. On Windows, this will simply open a new browser instance, you will have to manually paste thedevtools://
URL into the address bar.
Using the Debugger
- Ensure that Google Chrome or MS Edge is running (if you've set the path to the browser in Preferences you don't need to do this)
- Run an Archi script. A dialog box will appear with some explanation text and two buttons, "Continue" and "Debug".
- Press "Debug" to continue with the debug session. Press "Continue" to continue without debugging.
- If you press "Debug" a URL will be copied to the clipboard. On Windows, paste it into the address bar of Google Chrome or MS Edge. The URL is of the form
devtools://devtools/bundled/js_app.html?ws=127.0.0.1:9229/b98b7b01-f10b-4f6b-823f-87e1a647068f
. On Mac, if you've set the path to the browser you won't need to paste the URL into the address bar. Note that the UID in the URL is different for each debug session so you can't re-use it in another session. - Your debug and trace session should start and you can step over lines of code and set breakpoints in the browser
[!WARNING] If you don't follow the steps above correctly Archi will freeze and you will have to force quit!