You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will run gdbserver and either attach to or start an installed ACAP application to debug
User machine (desktop)
Use Visual Studio Code to run gdb-multiarch and connect to the gdbserver on the device.
Needs access to the application binary with debug symbols (not stripped)
Limitations
This tutorial requires root access on an Axis device and this solution will only work up until next AXIS OS LTS 2024. More information in this announcement.
This guide shows how to remote debug an ACAP application in VS Code. The approach is similar to the command-line approach in part 3 and will use the gdbserver from part 1 and the container image with the application binary with debug symbols from part 2 to debug an installed ACAP application. Part 3 doesn't represent a prerequisite.
On user machine
Start in the application directory from part 2. Create a folder called .devcontainerand add file devcontainer.json to it with the following content:
Now use the Visual Studio Code extension Dev Containers to start an instance of image hello-debug:1.9-armv7hf-dev.
Press F1
Select Dev Containers: Open Folder in Container...
Select the app directory
You are now attached to your development container. All the changes you make here will apply also to the application project in your local file system.
Open a terminal in the VS Code development container, then build and install the application.
In a terminal, SSH in to the device as root. Start gdbserver with the application binary installed under /usr/local/packages/APPNAME/BINARYNAME and open a TCP connection to a debug port on the Axis device, here port 1234 is used.
ssh root@192.168.0.90
root@axisdevice$ /tmp/gdbserver :1234 /usr/local/packages/hello_debug/hello_debug <Application_arguments>
Process /usr/local/packages/hello_debug/hello_debug created; pid = 21919
Listening on port 1234
The gdbserver will stop at the entry point of the application to let you add breakpoints and start stepping through the application from the user machine.
Start debugging
Now you can open the source code of your application, and start debugging by pressing F5.
If you wish to keep developing in the developer container you are using to debug, it is recommended to integrate this guide with the ACAP documentation page Setting up Visual Studio Code to also get the Visual Studio IntelliSense symbols auto-completion.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Important
This tutorial is replaced by remote-debug-example for AXIS OS versions 11.11 and later.
Introduction
This is a tutorial in three parts showing how-to remote debug an ACAP application on an Axis device from a user machine.
The setup
gdbserver
and either attach to or start an installed ACAP application to debuggdb-multiarch
and connect to thegdbserver
on the device.Limitations
Requirements
Part 3b - debug using Visual Studio Code
This guide shows how to remote debug an ACAP application in VS Code. The approach is similar to the command-line approach in part 3 and will use the
gdbserver
from part 1 and the container image with the application binary with debug symbols from part 2 to debug an installed ACAP application. Part 3 doesn't represent a prerequisite.On user machine
Start in the application directory from part 2. Create a folder called
.devcontainer
and add filedevcontainer.json
to it with the following content:Also create a
.vscode
directory and add filelaunch.json
to it with the following content:The work directory should look like this:
. ├── app │ └── .devcontainer │ │ └── devcontainer.json │ └── .vscode │ │ └── launch.json │ ├── hello_debug.c │ ├── LICENSE │ ├── Makefile │ └── manifest.json ├── Dockerfile └── README.md
Now use the Visual Studio Code extension Dev Containers to start an instance of image hello-debug:1.9-armv7hf-dev.
F1
Dev Containers: Open Folder in Container...
app
directoryYou are now attached to your development container. All the changes you make here will apply also to the application project in your local file system.
Open a terminal in the VS Code development container, then build and install the application.
Note
On Axis device
In a terminal, SSH in to the device as root. Start
gdbserver
with the application binary installed under /usr/local/packages/APPNAME/BINARYNAME and open a TCP connection to a debug port on the Axis device, here port 1234 is used.The
gdbserver
will stop at the entry point of the application to let you add breakpoints and start stepping through the application from the user machine.Start debugging
Now you can open the source code of your application, and start debugging by pressing
F5
.If you wish to keep developing in the developer container you are using to debug, it is recommended to integrate this guide with the ACAP documentation page Setting up Visual Studio Code to also get the Visual Studio IntelliSense symbols auto-completion.
Beta Was this translation helpful? Give feedback.
All reactions