mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 01:27:16 +08:00
proc,service,terminal: add events call use it for dld notifications (#3980)
Add a GetEvents method that can be used to retrieve debug events, adds events for downloading debug info through debuginfod and shows those events in the command line client as well as console messages in DAP. In the future this events mechanism can be used to unify EBPF tracepoints with old style tracepoints. Update #3906
This commit is contained in:
committed by
GitHub
parent
be3019a9eb
commit
17acdb87a7
@ -1059,7 +1059,7 @@ func (d *Debugger) IsRunning() bool {
|
||||
}
|
||||
|
||||
// Command handles commands which control the debugger lifecycle
|
||||
func (d *Debugger) Command(command *api.DebuggerCommand, resumeNotify chan struct{}, clientStatusCh chan struct{}) (state *api.DebuggerState, err error) {
|
||||
func (d *Debugger) Command(command *api.DebuggerCommand, resumeNotify chan struct{}, clientStatusCh chan struct{}, eventsFn func(*proc.Event)) (state *api.DebuggerState, err error) {
|
||||
if command.Name == api.Halt {
|
||||
// RequestManualStop does not invoke any ptrace syscalls, so it's safe to
|
||||
// access the process directly.
|
||||
@ -1085,8 +1085,16 @@ func (d *Debugger) Command(command *api.DebuggerCommand, resumeNotify chan struc
|
||||
d.setRunning(true)
|
||||
defer d.setRunning(false)
|
||||
|
||||
d.target.SetEventsFn(nil)
|
||||
if command.Name != api.SwitchGoroutine && command.Name != api.SwitchThread && command.Name != api.Halt {
|
||||
d.target.ResumeNotify(resumeNotify)
|
||||
|
||||
if eventsFn != nil {
|
||||
eventsFn(&proc.Event{Kind: proc.EventResumed})
|
||||
defer eventsFn(&proc.Event{Kind: proc.EventStopped})
|
||||
}
|
||||
|
||||
d.target.SetEventsFn(eventsFn)
|
||||
} else if resumeNotify != nil {
|
||||
close(resumeNotify)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user