diff options
| -rw-r--r-- | CONTRIBUTORS | 1 | ||||
| -rw-r--r-- | pkg/cover/backend/dwarf.go | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f4e93f0d9..0f1a890d6 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -140,3 +140,4 @@ Rivos Inc. Alexandre Ghiti Jeongjun Park Nikita Zhandarovich +Jiacheng Xu diff --git a/pkg/cover/backend/dwarf.go b/pkg/cover/backend/dwarf.go index a5f5e6cda..dc0911a1e 100644 --- a/pkg/cover/backend/dwarf.go +++ b/pkg/cover/backend/dwarf.go @@ -407,8 +407,11 @@ func readTextRanges(debugInfo *dwarf.Data, module *vminfo.KernelModule, pcFix pc } else { // Compile unit names are relative to the compilation dir, // while per-line info isn't. - // Let's stick to the common approach. - unitName := filepath.Join(attrCompDir, attrName) + // attrName could be an absolute path for out-of-tree modules. + unitName := attrName + if !filepath.IsAbs(attrName) { + unitName = filepath.Join(attrCompDir, attrName) + } ranges1, err := debugInfo.Ranges(ent) if err != nil { return nil, nil, err |
