diff options
| author | yuawn <ssspeed00@gmail.com> | 2022-10-05 14:40:55 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-10-05 17:06:49 +0200 |
| commit | 2c6543adc4c5a9108455d1e59b0df0d4afc05c99 (patch) | |
| tree | 0c29bfd974effd2fcdd788f288d78824693271ba /pkg | |
| parent | a82584ad77193697a8f722d7c461c0af94162672 (diff) | |
pkg/cover: fix ARM64 PCs adjusting
Fix by using array indexing and fixup kernel PCs only.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/cover/html.go | 7 |
1 files changed, 4 insertions, 3 deletions
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 |
