proc: replaced (*Breakpoint).Clear with (*Thread).ClearBreakpoint

This commit is contained in:
aarzilli 2017-02-10 15:27:49 +01:00 committed by Derek Parker
parent 423bcaa83a
commit 97cd3a0afe
3 changed files with 4 additions and 5 deletions

@ -72,9 +72,8 @@ func (bp *Breakpoint) String() string {
return fmt.Sprintf("Breakpoint %d at %#v %s:%d (%d)", bp.ID, bp.Addr, bp.File, bp.Line, bp.TotalHitCount) return fmt.Sprintf("Breakpoint %d at %#v %s:%d (%d)", bp.ID, bp.Addr, bp.File, bp.Line, bp.TotalHitCount)
} }
// Clear this breakpoint appropriately depending on whether it is a // ClearBreakpoint clears the specified breakpoint.
// hardware or software breakpoint. func (thread *Thread) ClearBreakpoint(bp *Breakpoint) (*Breakpoint, error) {
func (bp *Breakpoint) Clear(thread *Thread) (*Breakpoint, error) {
if _, err := thread.writeMemory(uintptr(bp.Addr), bp.OriginalData); err != nil { if _, err := thread.writeMemory(uintptr(bp.Addr), bp.OriginalData); err != nil {
return nil, fmt.Errorf("could not clear breakpoint %s", err) return nil, fmt.Errorf("could not clear breakpoint %s", err)
} }

@ -295,7 +295,7 @@ func (dbp *Process) ClearBreakpoint(addr uint64) (*Breakpoint, error) {
return nil, NoBreakpointError{addr: addr} return nil, NoBreakpointError{addr: addr}
} }
if _, err := bp.Clear(dbp.currentThread); err != nil { if _, err := dbp.currentThread.ClearBreakpoint(bp); err != nil {
return nil, err return nil, err
} }

@ -83,7 +83,7 @@ func (thread *Thread) StepInstruction() (err error) {
bp, ok := thread.dbp.FindBreakpoint(pc) bp, ok := thread.dbp.FindBreakpoint(pc)
if ok { if ok {
// Clear the breakpoint so that we can continue execution. // Clear the breakpoint so that we can continue execution.
_, err = bp.Clear(thread) _, err = thread.ClearBreakpoint(bp)
if err != nil { if err != nil {
return err return err
} }