diff --git a/command/command.go b/command/command.go index ef0af1c3..e53e88e1 100644 --- a/command/command.go +++ b/command/command.go @@ -124,7 +124,7 @@ func threads(p *proctl.DebuggedProcess, args ...string) error { if th == p.CurrentThread { prefix = "* " } - pc, err := th.CurrentPC() + pc, err := th.PC() if err != nil { return err } diff --git a/proctl/proctl.go b/proctl/proctl.go index 58745186..bbb42afa 100644 --- a/proctl/proctl.go +++ b/proctl/proctl.go @@ -348,7 +348,7 @@ func (dbp *DebuggedProcess) resume() error { if dbp.CurrentThread != thread { dbp.SwitchThread(thread.Id) } - pc, err := thread.CurrentPC() + pc, err := thread.PC() if err != nil { return err } @@ -445,8 +445,8 @@ func (dbp *DebuggedProcess) Registers() (Registers, error) { } // Returns the PC of the current thread. -func (dbp *DebuggedProcess) CurrentPC() (uint64, error) { - return dbp.CurrentThread.CurrentPC() +func (dbp *DebuggedProcess) PC() (uint64, error) { + return dbp.CurrentThread.PC() } // Returns the PC of the current thread. @@ -559,7 +559,7 @@ func (dbp *DebuggedProcess) handleBreakpointOnThread(id int) (*ThreadContext, er if !ok { return nil, fmt.Errorf("could not find thread for %d", id) } - pc, err := thread.CurrentPC() + pc, err := thread.PC() if err != nil { return nil, err } diff --git a/proctl/proctl_test.go b/proctl/proctl_test.go index 4fcca361..cab0d31a 100644 --- a/proctl/proctl_test.go +++ b/proctl/proctl_test.go @@ -57,7 +57,7 @@ func assertNoError(err error, t *testing.T, s string) { } func currentPC(p *DebuggedProcess, t *testing.T) uint64 { - pc, err := p.CurrentPC() + pc, err := p.PC() if err != nil { t.Fatal(err) } @@ -144,7 +144,7 @@ func TestBreakPoint(t *testing.T) { assertNoError(err, t, "Break()") assertNoError(p.Continue(), t, "Continue()") - pc, err := p.CurrentPC() + pc, err := p.PC() if err != nil { t.Fatal(err) } @@ -173,7 +173,7 @@ func TestBreakPointInSeperateGoRoutine(t *testing.T) { t.Fatal(err) } - pc, err := p.CurrentPC() + pc, err := p.PC() if err != nil { t.Fatal(err) } @@ -406,7 +406,7 @@ func TestFunctionCall(t *testing.T) { if err != nil { t.Fatal(err) } - pc, err = p.CurrentPC() + pc, err = p.PC() if err != nil { t.Fatal(err) } @@ -419,7 +419,7 @@ func TestFunctionCall(t *testing.T) { } if err = p.CallFn("runtime.getg", func() error { th := p.CurrentThread - pc, err := th.CurrentPC() + pc, err := th.PC() if err != nil { t.Fatal(err) } @@ -434,7 +434,7 @@ func TestFunctionCall(t *testing.T) { }); err != nil { t.Fatal(err) } - pc, err = p.CurrentPC() + pc, err = p.PC() if err != nil { t.Fatal(err) } diff --git a/proctl/threads.go b/proctl/threads.go index 2938b1f0..f70f13cb 100644 --- a/proctl/threads.go +++ b/proctl/threads.go @@ -42,7 +42,7 @@ func (thread *ThreadContext) Registers() (Registers, error) { } // Returns the current PC for this thread. -func (thread *ThreadContext) CurrentPC() (uint64, error) { +func (thread *ThreadContext) PC() (uint64, error) { regs, err := thread.Registers() if err != nil { return 0, err @@ -55,7 +55,7 @@ func (thread *ThreadContext) CurrentPC() (uint64, error) { // we step over any breakpoints. It will restore the instruction, // step, and then restore the breakpoint and continue. func (thread *ThreadContext) Continue() error { - pc, err := thread.CurrentPC() + pc, err := thread.PC() if err != nil { return err } @@ -74,7 +74,7 @@ func (thread *ThreadContext) Continue() error { // Single steps this thread a single instruction, ensuring that // we correctly handle the likely case that we are at a breakpoint. func (thread *ThreadContext) Step() (err error) { - pc, err := thread.CurrentPC() + pc, err := thread.PC() if err != nil { return err } @@ -158,7 +158,7 @@ func (thread *ThreadContext) Clear(addr uint64) (*BreakPoint, error) { // and setting a breakpoint at them. Once we've set a breakpoint at each // potential line, we continue the thread. func (thread *ThreadContext) Next() (err error) { - curpc, err := thread.CurrentPC() + curpc, err := thread.PC() if err != nil { return err } diff --git a/proctl/threads_darwin.go b/proctl/threads_darwin.go index 6e3c1053..95864246 100644 --- a/proctl/threads_darwin.go +++ b/proctl/threads_darwin.go @@ -48,7 +48,7 @@ func (t *ThreadContext) resume() error { func (t *ThreadContext) blocked() bool { // TODO(dp) cache the func pc to remove this lookup - pc, _ := t.CurrentPC() + pc, _ := t.PC() fn := t.Process.goSymTable.PCToFunc(pc) if fn != nil && (fn.Name == "runtime.mach_semaphore_wait" || fn.Name == "runtime.usleep") { return true diff --git a/proctl/threads_linux.go b/proctl/threads_linux.go index fa4cf423..d629d101 100644 --- a/proctl/threads_linux.go +++ b/proctl/threads_linux.go @@ -42,7 +42,7 @@ func (t *ThreadContext) singleStep() error { func (t *ThreadContext) blocked() bool { // TODO(dp) cache the func pc to remove this lookup - pc, _ := t.CurrentPC() + pc, _ := t.PC() fn := t.Process.goSymTable.PCToFunc(pc) if fn != nil && ((fn.Name == "runtime.futex") || (fn.Name == "runtime.usleep") || (fn.Name == "runtime.clone")) { return true diff --git a/proctl/variables.go b/proctl/variables.go index 262b12c1..bf107fe8 100644 --- a/proctl/variables.go +++ b/proctl/variables.go @@ -372,7 +372,7 @@ func offsetFor(name string, reader *dwarf.Reader, parentinstr []byte) (uint64, e // Returns the value of the named symbol. func (thread *ThreadContext) EvalSymbol(name string) (*Variable, error) { - pc, err := thread.CurrentPC() + pc, err := thread.PC() if err != nil { return nil, err } @@ -976,7 +976,7 @@ func (thread *ThreadContext) readMemory(addr uintptr, size uintptr) ([]byte, err // Fetches all variables of a specific type in the current function scope func (thread *ThreadContext) variablesByTag(tag dwarf.Tag) ([]*Variable, error) { - pc, err := thread.CurrentPC() + pc, err := thread.PC() if err != nil { return nil, err }