Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide VSCode launch and debug tasks for developers to build and debug SITL #24521

Open
Ryanf55 opened this issue Aug 6, 2023 · 2 comments
Open

Comments

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Aug 6, 2023

Feature request

Is your feature request related to a problem? Please describe.

Due to ArduPilot's highly custom simulation bringup (sim_vehicle.py), and lack of use of CMake or other common build tool, it's difficult to use VSCode's GUI support for configuring, building, testing, and debugging.

Developers are maintaining their own custom configs, but these aren't shared.

Describe the solution you'd like

Merge one of the dev's launch.json and tasks.json files that works on master, and then allow others to start contributing. When working, this provides the ability to use a keyboard shortcut to configure, build, run sim_vehicle.py, attach gdb, and inspect the code at a breakpoint WITHOUT using gdb's CLI. This can be faster and easier, but it still allows console-commands for gdb.

Here is a hard-coded launch and task showing a breakpoint being triggered in SITL.
image

Describe alternatives you've considered

ArduPilot/ardupilot_vscode_devenv#1

See the following branches:

bugobliterator/pr-vscode-tasks
khancyr/pr-vscode-tasks
TunaLobster/pr/vscode-rec-extensions

And the current wiki: https://ardupilot.org/dev/docs/debugging-with-gdb-using-vscode.html?highlight=vscode

Which has this flaw of needing to pick the process:
https://stackoverflow.com/questions/65723608/vs-code-debugging-is-it-possible-to-supply-process-id-pgrep-x-myprog-for

And, GDB console needs exec prefixed all the time:
microsoft/vscode-cpptools#106

And, ideally when you launch sim_vehicle from command line, you could add a --vscode-debug option that would launch the vscode debugger inside the current VSCode session
microsoft/vscode#10979

Some discussion in discord can be found here: https://discord.com/channels/674039678562861068/674039678982422579/1137475852838387913

        {
            "name": "Copter",
            "type": "cppdbg",
            "request": "attach",
            "program": "${workspaceFolder}/build/sitl/bin/arducopter",
            "processId": "${command:pickProcess}",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },

Platform
[x ] All
[ ] AntennaTracker
[ ] Copter
[ ] Plane
[ ] Rover
[ ] Submarine

@TompsonTan
Copy link

I think it's necessary to add more support to use VSCode, we need an efficient way for code reading,editing, and debug.

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Aug 10, 2023

I think it's necessary to add more support to use VSCode, we need an efficient way for code reading,editing, and debug.

Would you be interested in helping to contribute some Wiki changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants