Skip to content

service/dap: Implement suspended breakpoints - #4075

Merged
derekparker merged 3 commits into
go-delve:masterfrom
firelizzard18:dap-suspended-breakpoints
Sep 2, 2025
Merged

derekparker merged 3 commits into
go-delve:masterfrom
firelizzard18:dap-suspended-breakpoints

Conversation

@firelizzard18

Copy link
Copy Markdown
Contributor

This enables support for 'suspended' breakpoints, for example for a plugin that hasn't been loaded yet.

Fixes #4074

@firelizzard18

Copy link
Copy Markdown
Contributor Author

This is a draft because I'm not sure callbacks are the right approach.

Comment thread service/dap/server.go Resolved
@firelizzard18
firelizzard18 force-pushed the dap-suspended-breakpoints branch from 161731b to 6b055a5 Compare August 4, 2025 20:40
@firelizzard18
firelizzard18 marked this pull request as ready for review August 4, 2025 20:43
@firelizzard18
firelizzard18 force-pushed the dap-suspended-breakpoints branch from 6b055a5 to 1283a5d Compare August 4, 2025 20:48
@firelizzard18

Copy link
Copy Markdown
Contributor Author

I realized that the hack for setting the path of the breakpoint was totally unnecessary. Simply moving the Line and Source assignment behind if got.File != "" is enough.

@firelizzard18
firelizzard18 force-pushed the dap-suspended-breakpoints branch from 1283a5d to 11c1a21 Compare August 4, 2025 21:36
@aarzilli

aarzilli commented Aug 5, 2025

Copy link
Copy Markdown
Member

Some of the tests in service/dap are failing.

Comment thread service/dap/server.go Resolved
This enables support for 'suspended' breakpoints, for example for a
plugin that hasn't been loaded yet.

Fixes go-delve#4074
@firelizzard18
firelizzard18 force-pushed the dap-suspended-breakpoints branch from 11c1a21 to c54ace9 Compare August 6, 2025 18:20

@aarzilli aarzilli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread pkg/proc/target.go Resolved
Comment thread pkg/terminal/terminal.go Outdated
fmt.Fprintf(t.stdout, "\n")
}
case api.EventBreakpointMaterialized:
// Ignore

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would actually be a good idea to print to the terminal that certain breakpoints have been activated now that we have this plumbed through.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what to print so I went with "Breakpoint {id} materialized at {file}:{line} ({function})" with the function omitted if FunctionName is blank. As you can see below, the function name is maybe not helpful for plugins. I made the file path relative (if possible) because that seems nicer than printing out an absolute path.

Screenshot_20250902_152937

Comment thread service/dap/server.go Resolved

@firelizzard18 firelizzard18 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nothing to say here)

Comment thread pkg/proc/target.go Outdated
logger.Debugf("suspended breakpoint %d enabled", lbp.LogicalID)
}
if fn := t.BinInfo().eventsFn; fn != nil {
fn(&Event{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@derekparker In enableBreakpointOnTarget, if len(addrs) == 0 does it make sense to say the breakpoint is enabled? When I was testing, I set the breakpoint on line 6 of plugin.go (in my dumb-plugin repo) and that breakpoint was not hit (I assume) because no address was found. In that case, notifying the front end that a breakpoint was materialized seems misleading.

Comment thread pkg/proc/target.go Resolved
Comment thread pkg/terminal/terminal.go Outdated
fmt.Fprintf(t.stdout, "\n")
}
case api.EventBreakpointMaterialized:
// Ignore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what to print so I went with "Breakpoint {id} materialized at {file}:{line} ({function})" with the function omitted if FunctionName is blank. As you can see below, the function name is maybe not helpful for plugins. I made the file path relative (if possible) because that seems nicer than printing out an absolute path.

Screenshot_20250902_152937

Comment thread pkg/terminal/terminal.go Resolved

@derekparker derekparker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekparker
derekparker merged commit 987e99b into go-delve:master Sep 2, 2025
@firelizzard18
firelizzard18 deleted the dap-suspended-breakpoints branch September 2, 2025 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

service/dap: support suspended breakpoints

3 participants