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

config debug-info-directories terminal command fails with unsupported type for configuration key "debug-info-directories" #3179

Closed
dlipovetsky opened this issue Oct 30, 2022 · 4 comments
Labels

Comments

@dlipovetsky
Copy link
Contributor

  1. What version of Delve are you using (dlv version)?
Delve Debugger
Version: 1.9.1
Build: $Id: d81b9fd12bfa603f3cf7a4bc842398bd61c42940 $
  1. What version of Go are you using? (go version)?
go version go1.19.2 linux/amd64
  1. What operating system and processor architecture are you using?
GOOS="linux"
GOARCH="amd64"
  1. What did you do?
    I tried to set the debug-info-directories configuration parameter in the terminal.
  2. What did you expect to see?
    I expected to be able to set the parameter.
  3. What did you see instead?
(dlv) config debug-info-directories
Command failed: unsupported type for configuration key "debug-info-directories"
(dlv) config debug-info-directories foo 
Command failed: unsupported type for configuration key "debug-info-directories"
(dlv) config debug-info-directories foo bar
Command failed: unsupported type for configuration key "debug-info-directories"
(dlv) config debug-info-directories [foo]
Command failed: unsupported type for configuration key "debug-info-directories"
@dlipovetsky
Copy link
Contributor Author

dlipovetsky commented Oct 30, 2022

No test exercises setting this parameter. I've added a (failing) test here: dlipovetsky@23fa8a6. Stepping through (with delve, of course 😆), I found that the value is a Slice (as expected), but that the configureSet function only handles a Slice value for the substitute-path parameter. Otherwise, it passes the value to the ConfigureSetSimple function, which returns an error if the value is a Slice.

It's also worth noting that the above affected functions were duplicated by #2750, so the test and fix needs to be applied to service/dap, as well as ``pkg/terminal`. (I think it's worth de-duplicating this code in the long run, although that would be out of scope for this fix).

@dlipovetsky
Copy link
Contributor Author

I'm happy to work on a fix, but before I begin, I would appreciate some feedback. Thanks!

@aarzilli
Copy link
Member

Delve won't start unless it can find the debug info for the executable, because of this changing the value of debug-info-directories is not very useful. It would matter only for -save and for plugins, but it's worth fixing for that.
Note that it is insufficient to just fix configureSet to support slices, the new value needs to be propagate all the way to the backend, through service/rpc2 and to service/debugger.Debugger.config.DebugInfoDirectories.

aarzilli added a commit to aarzilli/delve that referenced this issue Apr 17, 2023
A series of interconnected changes to both the terminal command
'config', DAP command 'dlv config', quality of life improvements to how
substitute-path works, and better documentation.

- Let 'config substitute-path' show the current substitute path rules
- Add a -clear command to 'config substitute-path'
- Support 'config-debug-info-directories'
- rewrite SubstitutePath to be platform independent (see below)
- document path substitution more

Regarding the rewrite of SubstitutePath: the previous version used
runtime.GOOS and filepath.IsAbs to determine which filepath separator to use
and if matching should be case insensitive. This is wrong in all situations
where the client and server run on different OSes, when examining core files
and when cross-compilation is involved.

The new version of SubstitutePath checks the rules and the input path to
determine if Windows is involved in the process, if it looks like it is it
switches to case-insensitive matching. It uses a lax version of
filepath.IsAbs to determine if a path is absolute and tries to avoid having
to select a path separator as much as possible

Fixes go-delve#2891, go-delve#2890, go-delve#2889, go-delve#3179, go-delve#3332
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 26, 2023
A series of interconnected changes to both the terminal command
'config', DAP command 'dlv config', quality of life improvements to how
substitute-path works, and better documentation.

- Let 'config substitute-path' show the current substitute path rules
- Add a -clear command to 'config substitute-path'
- Support 'config-debug-info-directories'
- rewrite SubstitutePath to be platform independent (see below)
- document path substitution more

Regarding the rewrite of SubstitutePath: the previous version used
runtime.GOOS and filepath.IsAbs to determine which filepath separator to use
and if matching should be case insensitive. This is wrong in all situations
where the client and server run on different OSes, when examining core files
and when cross-compilation is involved.

The new version of SubstitutePath checks the rules and the input path to
determine if Windows is involved in the process, if it looks like it is it
switches to case-insensitive matching. It uses a lax version of
filepath.IsAbs to determine if a path is absolute and tries to avoid having
to select a path separator as much as possible

Fixes go-delve#2891, go-delve#2890, go-delve#2889, go-delve#3179, go-delve#3332, go-delve#3343
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 26, 2023
A series of interconnected changes to both the terminal command
'config', DAP command 'dlv config', quality of life improvements to how
substitute-path works, and better documentation.

- Let 'config substitute-path' show the current substitute path rules
- Add a -clear command to 'config substitute-path'
- Support 'config-debug-info-directories'
- rewrite SubstitutePath to be platform independent (see below)
- document path substitution more

Regarding the rewrite of SubstitutePath: the previous version used
runtime.GOOS and filepath.IsAbs to determine which filepath separator to use
and if matching should be case insensitive. This is wrong in all situations
where the client and server run on different OSes, when examining core files
and when cross-compilation is involved.

The new version of SubstitutePath checks the rules and the input path to
determine if Windows is involved in the process, if it looks like it is it
switches to case-insensitive matching. It uses a lax version of
filepath.IsAbs to determine if a path is absolute and tries to avoid having
to select a path separator as much as possible

Fixes go-delve#2891, go-delve#2890, go-delve#2889, go-delve#3179, go-delve#3332, go-delve#3343
aarzilli added a commit to aarzilli/delve that referenced this issue Apr 28, 2023
A series of interconnected changes to both the terminal command
'config', DAP command 'dlv config', quality of life improvements to how
substitute-path works, and better documentation.

- Let 'config substitute-path' show the current substitute path rules
- Add a -clear command to 'config substitute-path'
- Support 'config-debug-info-directories'
- rewrite SubstitutePath to be platform independent (see below)
- document path substitution more

Regarding the rewrite of SubstitutePath: the previous version used
runtime.GOOS and filepath.IsAbs to determine which filepath separator to use
and if matching should be case insensitive. This is wrong in all situations
where the client and server run on different OSes, when examining core files
and when cross-compilation is involved.

The new version of SubstitutePath checks the rules and the input path to
determine if Windows is involved in the process, if it looks like it is it
switches to case-insensitive matching. It uses a lax version of
filepath.IsAbs to determine if a path is absolute and tries to avoid having
to select a path separator as much as possible

Fixes go-delve#2891, go-delve#2890, go-delve#2889, go-delve#3179, go-delve#3332, go-delve#3343
derekparker pushed a commit that referenced this issue May 2, 2023
A series of interconnected changes to both the terminal command
'config', DAP command 'dlv config', quality of life improvements to how
substitute-path works, and better documentation.

- Let 'config substitute-path' show the current substitute path rules
- Add a -clear command to 'config substitute-path'
- Support 'config-debug-info-directories'
- rewrite SubstitutePath to be platform independent (see below)
- document path substitution more

Regarding the rewrite of SubstitutePath: the previous version used
runtime.GOOS and filepath.IsAbs to determine which filepath separator to use
and if matching should be case insensitive. This is wrong in all situations
where the client and server run on different OSes, when examining core files
and when cross-compilation is involved.

The new version of SubstitutePath checks the rules and the input path to
determine if Windows is involved in the process, if it looks like it is it
switches to case-insensitive matching. It uses a lax version of
filepath.IsAbs to determine if a path is absolute and tries to avoid having
to select a path separator as much as possible

Fixes #2891, #2890, #2889, #3179, #3332, #3343
@aarzilli
Copy link
Member

aarzilli commented May 2, 2023

Fixed by 13ad7dc

@aarzilli aarzilli closed this as completed May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants