From 2c6543adc4c5a9108455d1e59b0df0d4afc05c99 Mon Sep 17 00:00:00 2001 From: yuawn Date: Wed, 5 Oct 2022 14:40:55 +0000 Subject: pkg/cover: fix ARM64 PCs adjusting Fix by using array indexing and fixup kernel PCs only. --- pkg/cover/html.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pkg/cover/html.go') diff --git a/pkg/cover/html.go b/pkg/cover/html.go index 2fb16a7d8..1b37cb111 100644 --- a/pkg/cover/html.go +++ b/pkg/cover/html.go @@ -41,16 +41,17 @@ func fixUpPCs(target string, progs []Prog, coverFilter map[uint32]uint32) []Prog // so there is 0x18 bytes offset from module load address for .text section // we need to remove the 0x18 bytes offset in order to correct module symbol address if target == targets.ARM64 { - for _, prog := range progs { + for i, prog := range progs { var nPCs []uint64 for _, pc := range prog.PCs { // TODO: avoid to hardcode the address - if pc < 0xffffffd010000000 { + // Fix up kernel PCs, but not the test (userspace) PCs. + if pc >= 0x8000000000000000 && pc < 0xffffffd010000000 { pc -= 0x18 } nPCs = append(nPCs, pc) } - prog.PCs = nPCs + progs[i].PCs = nPCs } } return progs -- cgit mrf-deployment