Correctly handle hardware breakpoints across threads

* Set hardware breakpoints on all existing threads
* Set hardware breakpoints on any new thread the spawns

Fixes #111
This commit is contained in:
Derek Parker
2015-06-11 22:46:06 -05:00
parent d66dfbef54
commit 3fba1f7113
6 changed files with 28 additions and 18 deletions

View File

@ -120,8 +120,10 @@ func (dbp *DebuggedProcess) setBreakpoint(tid int, addr uint64, temp bool) (*Bre
break
}
if v == nil {
if err := setHardwareBreakpoint(i, tid, addr); err != nil {
return nil, fmt.Errorf("could not set hardware breakpoint: %v", err)
for t, _ := range dbp.Threads {
if err := setHardwareBreakpoint(i, t, addr); err != nil {
return nil, fmt.Errorf("could not set hardware breakpoint on thread %d: %s", t, err)
}
}
dbp.HWBreakPoints[i] = dbp.newHardwareBreakpoint(fn.Name, f, l, addr, nil, temp, i)
return dbp.HWBreakPoints[i], nil