pkg/proc: fix arm64 linux cgo stacktrace (#3192)

This patch introduces some changes, particularly to arm64SwitchStack
which fixes the test when running on linux/arm64. The changes causes the
same test to fail on darwin/m1 so temporarily keeping both versions.
Next step should be to refactor and unify the two so they both work with
the same function.

Fixes #2340
This commit is contained in:
Derek Parker
2022-11-15 00:05:43 -08:00
committed by GitHub
parent 824e0a81e8
commit 18ebd9195a
6 changed files with 165 additions and 59 deletions

View File

@ -407,7 +407,14 @@ func (it *stackIterator) advanceRegs() (callFrameRegs op.DwarfRegisters, ret uin
callimage := it.bi.PCToImage(it.pc)
callFrameRegs = op.DwarfRegisters{StaticBase: callimage.StaticBase, ByteOrder: it.regs.ByteOrder, PCRegNum: it.regs.PCRegNum, SPRegNum: it.regs.SPRegNum, BPRegNum: it.regs.BPRegNum, LRRegNum: it.regs.LRRegNum}
callFrameRegs = op.DwarfRegisters{
StaticBase: callimage.StaticBase,
ByteOrder: it.regs.ByteOrder,
PCRegNum: it.regs.PCRegNum,
SPRegNum: it.regs.SPRegNum,
BPRegNum: it.regs.BPRegNum,
LRRegNum: it.regs.LRRegNum,
}
// According to the standard the compiler should be responsible for emitting
// rules for the RSP register so that it can then be used to calculate CFA,