proc: fix switch to goroutine stack (#1948)

When switching to the goroutine stack the stack iterator registers
might not have any entry for the BP register, make sure to add it
instead of just trying to change it.
This commit is contained in:
Alessandro Arzilli 2020-03-20 19:32:41 +01:00 committed by GitHub
parent 7cd12c34fd
commit 112049176f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -267,7 +267,7 @@ func (it *stackIterator) switchToGoroutineStack() {
it.top = false it.top = false
it.pc = it.g.PC it.pc = it.g.PC
it.regs.Reg(it.regs.SPRegNum).Uint64Val = it.g.SP it.regs.Reg(it.regs.SPRegNum).Uint64Val = it.g.SP
it.regs.Reg(it.regs.BPRegNum).Uint64Val = it.g.BP it.regs.AddReg(it.regs.BPRegNum, op.DwarfRegisterFromUint64(it.g.BP))
if _, ok := it.bi.Arch.(*ARM64); ok { if _, ok := it.bi.Arch.(*ARM64); ok {
it.regs.Reg(it.regs.LRRegNum).Uint64Val = it.g.LR it.regs.Reg(it.regs.LRRegNum).Uint64Val = it.g.LR
} }