It is not too hard to debugging with VScode. You will be much more efficient. Please follow these steps
Step 1: Follow this page to set up VScode for debugging.
https://ardupilot.org/dev/docs/debugging-with-gdb-on-linux.html
yingfei@18:~$ sudo vi /etc/sysctl.d/10-ptrace.conf
[sudo] password for yingfei:
change the line kernel.yama.ptrace_scope = 1 to kernel.yama.ptrace_scope = 0
yingfei@18:~$ sudo service procps restart
Step 2: allow VS code to trace more files
yingfei@18:~$ sudo vi /etc/sysctl.conf
The limit can be increased to its maximum by editing /etc/sysctl.conf and adding this line to the end of the file:
fs.inotify.max_user_watches=524288
The new value can then be loaded in by running
yingfei@18:~$ sudo sysctl -p.
Step 3. Go to ardupilot folder, start VScode "code ." So, the working folder is set to "ardupilot" folder.
Now, in the "Run" menu, "Add a configuraiton" as in
https://ardupilot.org/dev/docs/debugging-with-gdb-on-linux.html
Click and select C/C++ : (gdb) Attach option.
Fill the “program” line with
"program": "${workspaceFolder}/build/sitl/bin/arducopter",
In my configuration, there two "program" line. Change them both.
Launch SITL with launch script sim_vehicle.py : simply add -D to build and launch SITL with debug symbols :
sim_vehicle.py -v ArduCopter -f quad --console --map -D
And in the "Run" menu, now start debugging with VSCode,
At the top left corner, In the "RUN" drop-down list, choose "(gdb) Attach"
it will ask you for a process name : type arducopter
Now you have attach the GDB to the arduilot code.
You can set breakpoints, e.g., in AC_WPNav.cpp
You can start the GPS code test_module_alt_0716.py to enable the SITL to fly.
You should able to see the breakpoints and watch the variable in this scope.
You can add more variable and expression