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

Apply config substitute-path to break and trace #2203

Closed
hyangah opened this issue Oct 16, 2020 · 3 comments
Closed

Apply config substitute-path to break and trace #2203

hyangah opened this issue Oct 16, 2020 · 3 comments

Comments

@hyangah
Copy link
Contributor

hyangah commented Oct 16, 2020

Currently config substitute-path rule applies only to source code retrieval, but does not apply to break and trace.

delve/pkg/config/config.go

Lines 231 to 232 in 71a460f

# Note that substitution rules will not be used for paths passed to "break" and "trace"
# commands.

When users opt into use config substitute-path, they need to interact with the source code in different location and absolute file paths. They often incorrectly assume the rule would apply to other commands. Please consider expanding the scope of path substitution.

Also, I noticed that the list or source code visualization uses the substitute path only to retrieve the source code. It keeps using the original path in display. If this feature request is accepted, changing that with the substituted path will be desirable for consistency.

(dlv) config substitute-path /dir/a /dir/b
(dlv) b /dir/a/main.go:9
Breakpoint 1 set at 0x106cedf for main.main() /dir/a/main.go:9
(dlv) c
1
> main.main() /dir/a/main.go:9 (hits goroutine(1):1 total:1) (PC: 0x106cedf)
     4:	
     5:	var a = 1
     6:	
     7:	func main() {
     8:		println(a)
=>   9:		a++
    10:		
 ...
@aarzilli
Copy link
Member

This isn't a simple change, the argument of break (and trace) is not a filepath, it's a location expression that's interpreted on the backend-side of delve, whereas substitutions are currently applied by the frontend.

@hyangah
Copy link
Contributor Author

hyangah commented Oct 21, 2020

It would be nice if users can choose this to be applied to backends - e.g. rpc methods like CreateBreakpoint that take Breakpoint with the file name as the input, and the dap implementation. cc @polinasok

aarzilli added a commit to aarzilli/delve that referenced this issue Oct 26, 2020
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements go-delve#2203
aarzilli added a commit to aarzilli/delve that referenced this issue Oct 26, 2020
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements go-delve#2203
aarzilli added a commit to aarzilli/delve that referenced this issue Oct 26, 2020
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements go-delve#2203
aarzilli added a commit to aarzilli/delve that referenced this issue Nov 11, 2020
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements go-delve#2203
aarzilli added a commit to aarzilli/delve that referenced this issue Nov 17, 2020
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements go-delve#2203
aarzilli added a commit that referenced this issue Nov 17, 2020
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements #2203
@aarzilli
Copy link
Member

Implemented by db93049

suzmue added a commit to suzmue/delve that referenced this issue Feb 25, 2021
Similar to substitute-path configuration in the dlv cli, substitutePath
in dap allows users to specify path mappings that are applied to the
source files in stacktrace and breakpoint requests.

Updates go-delve#2203
derekparker pushed a commit that referenced this issue Apr 15, 2021
* service/dap: add substitutePath configuration

Similar to substitute-path configuration in the dlv cli, substitutePath
in dap allows users to specify path mappings that are applied to the
source files in stacktrace and breakpoint requests.

Updates #2203

* service/dap: refactor the startup of the fixture for attach

Add a helper function for starting up a process to attach to.

* service/dap: update substitute path tests for windows

* service/dap: remove lines that should have been removed in merge

* respond to comments on pr

* move logging to helper functions

* make test comments more clear

* Add comments about absolute paths

* fix log messages

* clarify test comments

* remove comment about absolute paths
suzmue added a commit to suzmue/delve that referenced this issue Jun 4, 2021
* service/dap: add substitutePath configuration

Similar to substitute-path configuration in the dlv cli, substitutePath
in dap allows users to specify path mappings that are applied to the
source files in stacktrace and breakpoint requests.

Updates go-delve#2203

* service/dap: refactor the startup of the fixture for attach

Add a helper function for starting up a process to attach to.

* service/dap: update substitute path tests for windows

* service/dap: remove lines that should have been removed in merge

* respond to comments on pr

* move logging to helper functions

* make test comments more clear

* Add comments about absolute paths

* fix log messages

* clarify test comments

* remove comment about absolute paths
abner-chenc pushed a commit to loongson/delve that referenced this issue Mar 1, 2024
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements go-delve#2203
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