pkg,service: Use PCToFunc instead of PCToLine if it only needs func (#1894)

This commit is contained in:
chainhelen
2020-02-25 23:01:37 -06:00
committed by GitHub
parent 23b8e59ab9
commit 7560c33819
4 changed files with 4 additions and 4 deletions

View File

@ -213,7 +213,7 @@ func (a *ARM64) SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters)
}
}
_, _, fn := it.bi.PCToLine(it.frame.Ret)
fn := it.bi.PCToFunc(it.frame.Ret)
if fn == nil {
return false
}

View File

@ -4027,7 +4027,7 @@ func TestReadDefer(t *testing.T) {
if d.Unreadable != nil {
t.Fatalf("expected %q as %s of frame %d, got unreadable defer: %v", tgt, deferName, frameIdx, d.Unreadable)
}
_, _, dfn := p.BinInfo().PCToLine(d.DeferredPC)
dfn := p.BinInfo().PCToFunc(d.DeferredPC)
if dfn == nil {
t.Fatalf("expected %q as %s of frame %d, got %#x", tgt, deferName, frameIdx, d.DeferredPC)
}

View File

@ -1287,7 +1287,7 @@ func (d *Debugger) Disassemble(goroutineID int, addr1, addr2 uint64, flavour api
}
if addr2 == 0 {
_, _, fn := d.target.BinInfo().PCToLine(addr1)
fn := d.target.BinInfo().PCToFunc(addr1)
if fn == nil {
return nil, fmt.Errorf("address %#x does not belong to any function", addr1)
}

View File

@ -287,7 +287,7 @@ func (loc *AddrLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr str
addr, _ := constant.Uint64Val(v.Value)
return []api.Location{{PC: addr}}, nil
case reflect.Func:
_, _, fn := d.target.BinInfo().PCToLine(uint64(v.Base))
fn := d.target.BinInfo().PCToFunc(uint64(v.Base))
pc, err := proc.FirstPCAfterPrologue(d.target, fn, false)
if err != nil {
return nil, err