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

Improve automated path mapping in dlv debug adapter #3193

Open
suzmue opened this issue Feb 26, 2024 · 4 comments
Open

Improve automated path mapping in dlv debug adapter #3193

suzmue opened this issue Feb 26, 2024 · 4 comments
Labels
Debug Issues related to the debugging functionality of the extension.
Milestone

Comments

@suzmue
Copy link
Contributor

suzmue commented Feb 26, 2024

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

The legacy debug adapter implemented some support for automatic path mapping (#45). We want to deprecate the legacy debug adapter so should provide some automatic path mapping, which will likely take a different form than the legacy.

dlv dap uses the substitutePath setting in the launch.json attributes to configure mappings when the local and debugger paths do not match (such as with symlinked dirs, remote debugging, trimpath).

A lot of times users don’t know that they have to provide path mapping for the breakpoints to hit. Even if they do, they don’t provide the correct path mappings. So what happens is that the debugger appears to be running but no breakpoints are hit. This can cause a lot of confusion to the users.

Describe the solution you'd like
We can use the local configuration of the main modules, module cache, and GOROOT, to help automate this configuration.

This will need implementation work in github.com/go-delve/delve to do the mapping and modifications to the extension to provide the necessary data from the client.

Additional context
Related issues include #3175, #45

@suzmue suzmue added the Debug Issues related to the debugging functionality of the extension. label Feb 26, 2024
@gopherbot gopherbot added this to the Untriaged milestone Feb 26, 2024
@suzmue suzmue modified the milestones: Untriaged, v0.42.0 Feb 28, 2024
@gm0stache
Copy link

-> related? #3096

@hyangah
Copy link
Contributor

hyangah commented Mar 13, 2024

@suzmue Things seem complicated if Windows or case-insensitive OS is involved, since VS Code (DAP client) uses the absolute file paths instead of file uri or relative paths. In this case, I think we need more than Delve's substitutePath.

@dlipovetsky
Copy link
Contributor

This will need implementation work in github.com/go-delve/delve to do the mapping and modifications to the extension to provide the necessary data from the client.

Can you please elaborate on this? Does delve need to support the supportsLoadedSourcesRequest DAP capability?

I would like to help implement this, but am looking for some more context.

(I suppose the legacy implementation is not possible with DAP? As far as I understand it, the legacy implementation sends the sources command to the delve server. The delve server responds with a list of paths stored in the target executable debug info. Vscode-go then uses this list, together with information about local source paths, to generate a set of substitute paths, and submit them to the server using the config substitute-path command.)

@hyangah hyangah modified the milestones: v0.44.0, v0.46.0 Dec 9, 2024
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/643280 mentions this issue: extension: use Delve's guess-substitute-path-helper and dlv-dap when

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debug Issues related to the debugging functionality of the extension.
Projects
None yet
Development

No branches or pull requests

5 participants