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)
Will 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.
Part 1 - build a gdbserver
This guide shows how to build a container image that contains a program called gdbserver which is part of GDB.
The gdbserver will run on the Axis device and is cross-compiled on a user machine (e.g. x86) to the target architecture of the Axis device to debug (aarch64, armv7hf) using the ACAP Native SDK.
Note
This guide use:
GDB 9.2 and does not work for GDB >= 10
ACAP Native SDK 1.9 and is compatible with AXIS OS 11.5 or later.
It has not been tested but building with an earlier SDK should be possible and be compatible with earlier AXIS OS versions.
The Dockerfile
Save the following Dockerfile to your desktop as Dockerfile.gdb9-2
ARG ARCH=armv7hf
ARG VERSION=1.9
ARG UBUNTU_VERSION=22.04
ARG REPO=axisecp
ARG SDK=acap-native-sdk
FROM ${REPO}/${SDK}:${VERSION}-${ARCH}-ubuntu${UBUNTU_VERSION}
# Build GDB serverARG GDB_VERSION=9.2
ARG GDB_REPOSITORY=https://ftp.gnu.org/gnu/gdb
ARG GDB_ARCHIVE=gdb-${GDB_VERSION}.tar.gz
ARG GDB_BASE_DIR=/opt/build/gdb
ARG GDB_SOURCE_DIR=$GDB_BASE_DIR/src
ARG GDB_SERVER_CONF_DIR=$GDB_SOURCE_DIR/gdb/gdbserver
ARG GDB_BUILD_DIR=${GDB_BASE_DIR}/build
# The gdbserver will be installed to $GDB_INSTALL_DIR/bin/gdbserverARG GDB_INSTALL_DIR=${GDB_BASE_DIR}
ARG GDB_SERVER_BIN_DIR=${GDB_BASE_DIR}/bin
WORKDIR $GDB_BASE_DIR
RUN curl -sSL -O $GDB_REPOSITORY/$GDB_ARCHIVE
WORKDIR $GDB_SOURCE_DIR
RUN tar -xf $GDB_BASE_DIR/$GDB_ARCHIVE -C $GDB_SOURCE_DIR --strip-components=1
WORKDIR $GDB_BUILD_DIR
RUN . /opt/axis/acapsdk/environment-setup* && \
$GDB_SERVER_CONF_DIR/configure \
--host=$($CC -dumpmachine) \
--prefix=${GDB_INSTALL_DIR} \
--with-sysroot=${SDKTARGETSYSROOT}
RUN make && \
make install
# Install ssh to scp gdbserver to deviceRUN DEBIAN_FRONTEND=noninteractive \
apt-get update && apt-get install -y -f --no-install-recommends \
ssh \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR $GDB_SERVER_BIN_DIR
Build container image with gdbserver
In the same directory as you stored the Dockerfile, build the gdbserver for the architecture of your Axis device
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
Part 1 - build a gdbserver
This guide shows how to build a container image that contains a program called gdbserver which is part of GDB.
The
gdbserver
will run on the Axis device and is cross-compiled on a user machine (e.g. x86) to the target architecture of the Axis device to debug (aarch64, armv7hf) using the ACAP Native SDK.The Dockerfile
Save the following Dockerfile to your desktop as
Dockerfile.gdb9-2
Build container image with gdbserver
In the same directory as you stored the Dockerfile, build the
gdbserver
for the architecture of your Axis deviceInstall gdbserver to Axis device
Next step
Continue to Part 2 - application with debug symbols
Beta Was this translation helpful? Give feedback.
All reactions