Remote Debug and Deploy Projects
This article presents instructions used to remotely debug and deploy your project on your target device. With the Torizon IDE Extension 2, you can troubleshoot your application running on your target device directly from your host machine by adding breakpoints to your source code in Visual Studio Code.
- Having understood the basics of Torizon IDE Extension 2.
- Toradex Computer on Module (CoM) with TorizonCore installed.
- Having connected a TorizonCore target device.
Remote Debug and Deploy
Check if the desired device is set as the default.
To differentiate between the registered devices and the default device, look for the following highlighted icon:
Check if the recommended extensions are installed: all templates include a file named .vscode/extensions.json, which specifies a list of recommended extensions for the project. These extensions commonly will add the LSP (language server protocol) support for the project language, syntax highlight, code formatting, debugger, etc.
Open the Command Palette(
Extensions: Show Recommended Extensions. Select it.
It will open the Extensions menu and show the list of recommended extensions.
Install all by clicking the
Install Workspace Recommended Extensionsicon.
Start the debug session:
Run and Debug (Ctrl+Shift+D)icon in the VS Code left menu bar.
Select the option that matches the architecture of your default target device:
Torizon ARMv8: for ARM 64 bit devices.
Torizon ARMv7: for ARM 32 bit devices.
Start Debuggingicon (or press
Once you have selected one architecture option, VS Code will use it as the default option for the next debugging sessions. So, the next time you want to debug your project, just press
F5, and VS Code will automatically run from the last selected architecture.
The remote deployment and debugging process will start. Wait until the end of the process. VS Code will automatically change to the Debug Console tab, which displays the output logs of the debugger and application.
Also, you can follow the build/deploy progress by looking at the VS Code window footer and task tabs, as the following image highlights.
Add Breakpoints: The templates are not set up to break at the application's entry. Then, to debug your application, you need to set a breakpoint on the code.
Click on the left side of the line number where you want to set the breakpoint.
Run the debug process (press
F5): The application will start running and then stop at the breakpoint.
You can now use all the standard debugging features in VS Code to debug your application. See the VS Code Debugging documentation for more details.