-
Notifications
You must be signed in to change notification settings - Fork 798
Take advantage of suspending breakpoint provided by delve #3713
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
Comments
After trying to add type CreateBreakpointIn struct {
Breakpoint api.Breakpoint
LocExpr string
SubstitutePathRules [][2]string
// Suspended decides whether the breakpoint is suspended when its location
// is not found when creating it
Suspended bool `json:"suspended"`
} this.delve?.isApiV1 ? breakpointIn : { Breakpoint: breakpointIn, suspended: true } unwanted breakpoint: Reproduce the above screenshot: git clone -b fixSuspended https://github.com/Lslightly/delve.git
git clone -b fixSuspended https://github.com/Lslightly/delve-dbg-child-proc.git
cd delve-dbg-child-proc
go build -gcflags "-N -l" . # avoid optimization and inlining
cd utils
go build -gcflags "-N -l" . # avoid optimization and inlining
cd ../../
git clone --depth 2 -b fixSuspended https://github.com/Lslightly/vscode-go.git
cd delve
# build delve
make build
# backup old dlv in your GOPATH
cp $(go env GOPATH)/bin/dlv $(go env GOPATH)/bin/dlv_backup
# use new dlv
ln -s $(pwd)/dlv $(go env GOPATH)/bin/dlv
# install vscode-go dependencies
cd ../vscode-go/extension
npm ci
# Then press launch F5 as docs/contribution.md says.
# open delve-dbg-child-proc in [Extension Development Host] vscode instance
# launch debug session in delve
# launch debug session in [Extension Development Host] vscode instance
|
see golang/vscode-go#3713 (comment). add some information necessary for vscode-go
Just FYI, I don't think the legacy adapter is being actively developed. |
Thanks. I also see the caller of got, err = s.debugger.CreateBreakpoint(bp, "", nil, false)
if suspended {
// Create a breakpoint with enough information although its location is not found to cheat the frontend
// Not completed yet.
// Possibly notifying the client through err is a better solution
// ErrSuspended can be a part of RPC interface
createdBp.FunctionName = setbp.FunctionName
createdBp.File = setbp.File
createdBp.Line = setbp.Line
createdBp.ExprString = setbp.ExprString
} Besides, @firelizzard18 Thanks for your detailed explanation of what |
Uh oh!
There was an error while loading. Please reload this page.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.- the dlv is the version not released yet in https://github.com/Lslightly/delve/tree/followExecByDefault which enable
target follow-exec -on
by default and fixed some other bugs(see service/debugger: fix FindLocation with child processes by aarzilli · Pull Request #3937 · go-delve/delve).Environment
GOBIN: undefined
toolsGopath:
gopath: /home/lqw/go
GOROOT: /home/lqw/go1.24.0
PATH: /home/lqw/.vscode-server/bin/6609ac3d66f4eade5cf376d1cb76f13985724bcb/bin/remote-cli:/home/lqw/.rvm/gems/ruby-3.0.0/bin:/home/lqw/.rvm/gems/ruby-3.0.0@global/bin:/home/lqw/.rvm/rubies/ruby-3.0.0/bin:/home/lqw/mygit/delve:/home/lqw/go/bin:/home/lqw/go1.24.0/bin:/home/lqw/scripts:/home/lqw/cmake/bin:/home/lqw/.local/bin:/home/lqw/miniconda3/bin:/home/lqw/miniconda3/condabin:/home/lqw/.opam/default/bin:/home/lqw/.elan/bin:/home/lqw/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/home/lqw/.rvm/bin
Tools
Go env
Workspace Folder (delve): /home/lqw/mygit/delve
Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes.Describe the bug
A clear and concise description of what the bug.
A clear and concise description of what you expected to happen.
Bug: The
suspended
argument is always false whenCreateBreakpoint
is invoked in delve server through RPC call by vscode-go debug adapter. The consequence is that when the location of a breakpoint is not found in the delve debugger, the breakpoint will be deleted in service/debugger/debugger.go#L792-L797 as shown in the following code, which makes vscode frontend fail to set the breakpoint. Current interface not fully utilizes the ability of suspending breakpoints in delve, which can limit vscode-go debug adapter's ability in cases like multiple process debugging even ifFollowExec
is enabled.What I expected to see:
suspended
is always sent true so that when the location of a breakpoint is not found, the breakpoint can still be suspended. In the future, the breakpoint will be valid.The interfaces in both sides are:
vscode-go/extension/src/debugAdapter/goDebug.ts
Line 2189 in 1a21ede
argv = reflect.New(mtype.ArgType)
at https://github.com/go-delve/delve/blob/570f5725d595dc698d257f91326e677b9eda89df/service/rpccommon/server.go#L238function.Call([]reflect.Value{argv, reflect.ValueOf(ctl)})
at https://github.com/go-delve/delve/blob/570f5725d595dc698d257f91326e677b9eda89df/service/rpccommon/server.go#L295s.debugger.CreateBreakpoint(&arg.Breakpoint, arg.LocExpr, arg.SubstitutePathRules, arg.Suspended)
at https://github.com/go-delve/delve/blob/570f5725d595dc698d257f91326e677b9eda89df/service/rpc2/server.go#L263Current interface in delve is:
Code of delve
Describe the solution you'd like
A clear and concise description of what you want to happen.
add
suspended
in RPC pack. vscode-go always sendsuspended=true
to delve.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
nothing yet.
Additional context
Add any other context or screenshots about the feature request here.
This issue is blocking #3712. #3712 is a promising enhancement.
Related PR: go-delve/delve#3900
The text was updated successfully, but these errors were encountered: