mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 20:53:42 +08:00
Ensure thread is stopped before setting breakpoint
For hardware breakpoints we have to set them on every thread. It could be the case that another thread is running. Stop it first, set the breakpoint, then continue it.
This commit is contained in:
@ -18,16 +18,18 @@ func (t *Thread) Halt() error {
|
||||
}
|
||||
err := sys.Tgkill(t.dbp.Pid, t.Id, sys.SIGSTOP)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Halt err %s %d", err, t.Id)
|
||||
return fmt.Errorf("halt err %s on thread %d", err, t.Id)
|
||||
}
|
||||
_, _, err = wait(t.Id, 0)
|
||||
if err != nil {
|
||||
return fmt.Errorf("wait err %s %d", err, t.Id)
|
||||
return fmt.Errorf("wait err %s on thread %d", err, t.Id)
|
||||
}
|
||||
t.running = false
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Thread) resume() (err error) {
|
||||
t.running = true
|
||||
t.dbp.execPtraceFunc(func() { err = PtraceCont(t.Id, 0) })
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user