mirror of
https://github.com/go-delve/delve.git
synced 2025-10-30 02:07:58 +08:00
pkg,service: Use PCToFunc instead of PCToLine if it only needs func (#1894)
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user