Skip to content

Commit

Permalink
bpflbr: Trim ./ from file name
Browse files Browse the repository at this point in the history
Signed-off-by: Leon Hwang <[email protected]>
  • Loading branch information
Asphaltt committed Dec 5, 2024
1 parent d1779c2 commit 91ff89b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/bpflbr/bpf_prog_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (b *bpfProgAddrLineInfo) get(addr uintptr) (*bpfProgLineInfo, bool) {
var line bpfProgLineInfo
line.funcName = b.funcName
line.ksymAddr = b.kaddrRange.start
line.fileName = b.lineInfos[idx].Line.FileName()
line.fileName = strings.TrimLeft(b.lineInfos[idx].Line.FileName(), "./")
line.fileLine = b.lineInfos[idx].Line.LineNumber()
return &line, true
}
Expand Down
3 changes: 2 additions & 1 deletion internal/bpflbr/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ func DumpProg(pf []ProgFlag) {
for len(fnInsns) > 0 {
kaddr := ksym + pc
if li, ok := jited2LineInfos[kaddr]; ok {
fileName := strings.TrimLeft(li.Line.FileName(), "./")
fmt.Fprintf(&sb, "; %s:%d:%d %s\n",
li.Line.FileName(), li.Line.LineNumber(), li.Line.LineColumn(),
fileName, li.Line.LineNumber(), li.Line.LineColumn(),
strings.TrimSpace(li.Line.Line()))
}

Expand Down

0 comments on commit 91ff89b

Please sign in to comment.