Debugging Apps with gdb
How to analyze an app with GDB
The instructions below use the global_navigation example application for the Auterion SDK. The method explained is valid for any C++ application for AuterionOS.
Remove the CMD line for the executable you would like to debug from your Dockerfile so you can start it manually:
CMD . /opt/ros/humble/setup.sh && \
/opt/sysroot/app/build/global_navigationInstall gdb by adding this line to the end of your app's Dockerfile:
RUN apt update && apt install -y gdb && \
apt clean && \
rm -rf /var/lib/apt/lists/*Compile with debugging flags, for use with gdb by adding
-DCMAKE_BUILD_TYPE=Debugto cmake in your dockerfile:
RUN . /opt/sysroot/opt/ros/humble/setup.sh && \
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=/Toolchain_$TARGETARCH.cmake
-DCMAKE_BUILD_TYPE=Debug && cmake --build buildCopy the source code from the build stage of your Dockerfile:
COPY --from=build-stage /opt/sysroot/app/src /opt/sysroot/app/srcStart a container with the docker image of the modified app:
root@skynode-111261566:~# docker run -it 0d47ef72670b
root@2fdac2bb88c5:/# source /opt/ros/humble/setup.shStart gdb with your executable:
Add breakpoints and run your executable:
Last updated