diff options
| author | Joey Jiao <quic_jiangenj@quicinc.com> | 2024-05-14 15:52:08 +0800 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-05-27 09:44:25 +0000 |
| commit | 3eba45d51db7adab6fb1d3c7e71d699ca6bea4b3 (patch) | |
| tree | 5c19d2ac9aadb9177985f0c7204cd3bb15e4da3b /pkg | |
| parent | b75d07e8995d9d6682851c553b23b4d3e9734436 (diff) | |
pkg/cover: fix offset in canonicalizer
- offset is int64 on some 64bit os
- for core kernel, no need to add offset
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/cover/canonicalizer.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkg/cover/canonicalizer.go b/pkg/cover/canonicalizer.go index 7241a7478..c9678585c 100644 --- a/pkg/cover/canonicalizer.go +++ b/pkg/cover/canonicalizer.go @@ -40,7 +40,8 @@ type convertContext struct { // Contains the offset and final address of each module. type canonicalizerModule struct { - offset int + offset int64 + name string endAddr uint64 // Discard coverage from current module. // Set to true if module is not present in canonical. @@ -93,13 +94,15 @@ func (can *Canonicalizer) NewInstance(modules []KernelModule) *CanonicalizerInst instAddr := module.Addr canonicalToInstMap[canonicalAddr] = &canonicalizerModule{ - offset: int(instAddr) - int(canonicalAddr), + offset: int64(instAddr - canonicalAddr), + name: module.Name, endAddr: module.Size + canonicalAddr, discard: discard, } instToCanonicalMap[instAddr] = &canonicalizerModule{ - offset: int(canonicalAddr) - int(instAddr), + offset: int64(canonicalAddr - instAddr), + name: module.Name, endAddr: module.Size + instAddr, discard: discard, } @@ -203,7 +206,9 @@ func (convert *Convert) convertPC(pc uint64) (uint64, bool) { if module.discard { return pc, false } - pc = uint64(int(pc) + module.offset) + if module.name != "" { + pc = uint64(int64(pc) + module.offset) + } } } return pc, true |
