mirror of
				https://github.com/go-delve/delve.git
				synced 2025-11-01 03:42:59 +08:00 
			
		
		
		
	Rename CurrentPC -> PC
This commit is contained in:
		| @ -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 | ||||
| 		} | ||||
|  | ||||
| @ -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 | ||||
| 	} | ||||
|  | ||||
| @ -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) | ||||
| 		} | ||||
|  | ||||
| @ -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 | ||||
| 	} | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
| 	} | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Derek Parker
					Derek Parker