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

Warning message when specifying build flags in dap mode is unclear #3462

Open
aathan opened this issue Aug 10, 2023 · 1 comment
Open

Warning message when specifying build flags in dap mode is unclear #3462

aathan opened this issue Aug 10, 2023 · 1 comment

Comments

@aathan
Copy link

aathan commented Aug 10, 2023

  1. What version of Delve are you using (dlv version)?
    Delve Debugger
    Version: 1.20.1
    Build: $Id: 96e65b6c615845d42e0e31d903f6475b0e4ece6e $

  2. What version of Go are you using? (go version)?
    go version go1.19.3 linux/amd64

  3. What operating system and processor architecture are you using?
    ubuntu amd64

  4. What did you do?
    trying to find a way to get vscode to pass launch arguments which appears to be how to potentially pass dlvFlags to a remote dlv???

  5. What did you expect to see?
    Some reference somewhere in either the go vscode extension or in the dlv docs, how to pass these arguments. Something beyond the cryptic Warning: build flags ignored with dap; specify via launch/attach request instead
    I can't even seem to find anything in the vscode documentation itself about how to do this; and googling for this info is damn-near impossible because all the responsive documents are about how to pass arguments to the program being debugged (not the debugger itself).

  6. What did you see instead?
    cryptic error message

Also, I did open a discussion about this which may end up having some relevant notes: #3461

EDIT: Wouldn't it be simpler/nicer to allow the use of the dlvFlags available to dlv via the config, if nothing is specified in the launch request?! Seems disallowing this just gets in the way of the simplest possible config. E.g. in the below config, the dlvFlags arrive at the far end dlv, which then generates the above Warning, when it could have just used those flags and made my life easy.

Also, maybe the vscode go extension needs a bug filed on this issue too? I'm guessing it supplies some kind of validation schema for "type":go configurations, and that validation schema does not seem to allow specifying an "arguments" item, if that's what's needed.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}/go/cmd/thingBeingDebugged",
            "env": {},
            "dlvFlags": [
                "--build-flags",
                "-mod=mod"
            ],
            "args": [
                "-progarg1"
            ]
        }
    ]
}
@aathan
Copy link
Author

aathan commented Aug 10, 2023

I'm leaving this open since an update to the error message may be warranted.

The solution seems to be to use buildFlags in launch.json. It took quite a bit of digging to figure this out, and it may be good to change the wording of the help message provided by delve. E.g., it could say Warning: configured build flags ignored in dap mode; specify within launch/attach request instead (e.g., vscode-go's buildFlags in launch.json)

I'm assuming in practice 99% of dap mode use is via vscode.

@aarzilli aarzilli changed the title passing dlvFlags from vscode in dap mode seems impossible Warning message when specifying build flags in dap mode is unclear Aug 11, 2023
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

2 participants