We are trying to remote debug a simple telemetry service installed on the drone deployed on Sphinx. We would like to use either VSCode or Pycharm. We tried several things using adb forwarding. We are able connect and issue adb commands from a terminal but we cannot find any VSCode or pycharm plugins to enable controlling breakpoints from the ide.
To debug your firmware with Parrot Sphinx, you need:
- a GDB server running in the simulated firmware
- a GDB client on the host side
The command gdbserver_sphx launches the program or attaches to the program to be debugged. This script must be launched on the host and works both for boxinit services or other programs. For example if you want to debug a new instance of the program ls
:
gdbserver_sphx --program ls
If you want to attach a GDB server to an already existing service telemetry_service
:
gdbserver_sphx --attach --service telemetry_service
Once gdbserver is running on the firmware side, you need to start a GDB session on the host side using gdbclient_sphx like below.
gdbclient_sphx /path/to/alchemy.gdb telemetry_service
alchemy.gdb is a file that you will find in your workspace output directory.
Getting to this stage, you can now use GDB as usual.
This makes a lot of senses. Can you tell me where can I find documentation about the gdbserver_sphx. It’s installed on the BusyBox
db shell
BusyBox v1.35.0 (2023-07-27 13:25:40 UTC) built-in shell (ash)
Enter 'help' for a list of built-in commands.
root@anafi2:/ # cd ~
root@anafi2:~ # gdbserver_sphx
/bin/sh: gdbserver_sphx: not found
gdclient_sphx and gdbserver_sphx are host commands that come with sphinx in /usr/bin/.
I use anafi2-pc.ext2.zip firmware and cant find the gdbserver. Should i use an other firmware?
You can copy your own gdbserver in the simulated firmware:
sudo cp /usr/bin/gdbserver $(fdc get_property instances $(fdc list instances | sed 's/\[.*//g') root | sed 's/\union.*//g')fs/rw/usr/bin
Hello Ocrave, (I am a collegue of Erick)…
Seems that the folder name generated by:
$(fdc get_property instances $(fdc list instances | sed ‘s/[.//g’) root | sed 's/\union.//g’)fs/rw/usr/bin
GOT:
showing that “bin” does not exist under …/fs/rw/usr, only the “lib” seems to be there (bin would not be in the rw section)
Instead of attempting to “change” the local mount content extracted from the original firmware, we’ve “re-created” a firmware (unzip, mount, zip) with /usr/bin/gdbserver “already” copied inside…
- anafi2-pc-mod1.ext2.zip (mod1, now includes /usr/bin/gdbsercer)
Note: needed to remove the previously cached firmware:
sudo mv /usr/share/firmwared/firmwares//anafi2-pc.ext2.zip.c6f46ef1-4e98-4606-88b3-d2ab7ff15408.firmware /root
before re-launching sphinx with the “new” local copy of the firmware:
sphinx ~/code/anafi_ai_wan.drone
<?xml version="1.0" encoding="UTF-8"?> default auto true 500MB 10G 1 1 1 0 /home/nicolas/code/anafi2-pc-mod1.ext2.zip
That is with ~/code/anafi_ai_wan.drone
But then lauching: gdbserver_sphx:
gdbserver_sphx --attach --service example_telemetry
GOT:
remote_addr=10.202.0.1
remote_adb_port=9050
and then on another terminal:
gdbclient_sphx .airsdk/out/telemetry_py-anafi2_pc/alchemy.gdb
GOT:
example_telemetry 10.202.0.1:9050
find: ‘/home/nicolas/code/airsdk-samples/telemetry_py/.airsdk/out/telemetry_py-anafi2_classic/staging\n/home/nicolas/code/airsdk-samples/telemetry_py/.airsdk/out/telemetry_py-anafi2_pc/staging’: No such file or directory
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type “show copying” and “show warranty” for details.
This GDB was configured as “x86_64-linux-gnu”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.For help, type “help”.
Type “apropos word” to search for commands related to “word”.
No executable file now.
No symbol file now.
Remote debugging using 10.202.0.1:9050
Remote connection closed
(gdb)
HENCE self disconnected…
Please note we are trying to “debug” the “Python” project “telemetry_py”
Hello, we were able to successfully attach a debug session between VSCode and the deployed drone in sphinx. We are using debugpy and had to augment the firmware with debugpy package.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
Sorry the misunderstanding. I was assuming that you were debugging a c/c++ service, not a python one. I am glad you found a proper solution to your problem.