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

Starting a debug session triggers the error "Don't know how to run. Try "help target"." #128

Closed
omarArm opened this issue Dec 18, 2024 · 4 comments

Comments

@omarArm
Copy link

omarArm commented Dec 18, 2024

Hi,

I am trying to use the extension to run the command arm-none-eabi-gdb <my_program.elf>. However, I am receiving the error

Don't know how to run. Try "help target".

Here is my launch.json configuration,

{
            "type": "gdb",
            "request": "launch",
            "name": "Debug with eclipe",
            "program": "${workspaceFolder}/armgcc/debug/led_blinky_cm0.elf",
            "cwd": "${workspaceFolder}",
            "verbose": true,
            "openGdbConsole": true,
            "gdb": "arm-none-eabi-gdb"        
}

It is the first time I use the extension, so please go easy on me and assume that I know nothing

Environment:

Machine: macOS, Sequoia 15.1, M2 chip
VScode version: 1.96.0
Extension version: 1.0.1

@jonahgraham
Copy link
Contributor

jonahgraham commented Dec 18, 2024

The key change you want is "type": "gdbtarget" because it is for target debugging and "type": "gdb" is for host debugging. I think you will also want to fill in the "target" structure.

Consider doing a "request": "attach", if you are launching your gdbserver manually (e.g. Starting JLlink GDB Server yourself).

If you do "request": "launch", then you need to specify which gdbserver the adapter should automatically launch for you.

{
            "type": "gdbtarget",
            "request": "launch",
            "name": "Debug with eclipe",
            "program": "${workspaceFolder}/armgcc/debug/led_blinky_cm0.elf",
            "cwd": "${workspaceFolder}",
            "verbose": true,
            "openGdbConsole": true,
            "gdb": "arm-none-eabi-gdb"        
}

assume that I know nothing

No worries - there is very little to no documentation. Where the above info should be is https://github.com/eclipse-cdt-cloud/cdt-gdb-vscode?tab=readme-ov-file#launch-settings but no one has written that yet.

Please ask more questions.

@omarArm
Copy link
Author

omarArm commented Dec 19, 2024

Thanks a lot for your quick reply. I am now trying two different approaches

  1. using the request: "attach", because obviously that is the easier route that would make things work faster.
  2. using the request: "launch", because I want to start my debugging session from a single gate. As in just with the click of a button everything works, without the need to start a gdbserver on another terminal

Now regarding option 1, everything is working just fine, no problems

Now regarding option 2, I would like to run the gdbserver using pyocd, so I added server: "pyocd gdbserver" to my configuration. However, I am facing another error that is

gdbserver has hit error Error: spawn pyocd gdbserver ENOENT

Please find here my launch.json for the launch request

       {
            "type": "gdbtarget",
            "request": "launch",
            "name": "Debug with eclipe launching",
            "program": "${workspaceFolder}/armgcc/debug/led_blinky_cm0.elf",
            "cwd": "${workspaceFolder}",
            "verbose": true,
            "gdb": "/Users/omaelk01/.vcpkg/artifacts/2139c4c6/compilers.arm.arm.none.eabi.gcc/13.3.1/bin/arm-none-eabi-gdb",
            "target": {
                "server": "pyocd gdbserver",
                "port": "3333",
                "serverParameters": []
            }

}

Sorry to be bombarding you with all of that. Any help would be appreciated

@jonahgraham
Copy link
Contributor

Now regarding option 2, I would like to run the gdbserver using pyocd, so I added server: "pyocd gdbserver" to my configuration. However, I am facing another error that is

The server needs to be a command, so just pyocd in this case and then any command line parameters passed in serverParameters, e.g. "serverParameters": ["gdbserver"]

If you are interested in under the hood, this is because of how server and serverParameters are passed to spawn: (source link)

@omarArm
Copy link
Author

omarArm commented Dec 30, 2024

It is working now, thank you!

@omarArm omarArm closed this as completed Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants