Skip to content

fix: restore absolute DWARF source paths - #18

Merged
dylandreimerink merged 1 commit into
cilium:mainfrom
immanuwell:fix/dwarf-absolute-source-path
Aug 10, 2026
Merged

fix: restore absolute DWARF source paths#18
dylandreimerink merged 1 commit into
cilium:mainfrom
immanuwell:fix/dwarf-absolute-source-path

Conversation

@immanuwell

@immanuwell immanuwell commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Clang 22 can emit an absolute DWARF file name alongside a compilation directory
Go's DWARF reader joins them, so stackwhere reports /go/src/basic.c even though the real path is /src/basic.c

Repro:

audit_dir=$(mktemp -d)
docker run -v "$PWD/testdata:/src:ro" -v "$audit_dir:/out" -w /go ghcr.io/cilium/ebpf-builder:1777990914 clang-22 -g -O2 -target bpf -c /src/basic.c -o /out/basic.o
go run ./cmd/stackwhere list "$audit_dir/basic.o" cil_entry

Before: 32 - a @ /go/src/basic.c:72

After: 32 - a @ /src/basic.c:72

The fix restores the compilation unit path only when the bad joined form matches exactly
Relative and already-correct paths stay as-is, regression coverage is included too

Tests: go test ./..., go test -race ./..., go vet ./..., golangci-lint run

Signed-off-by: immanuwell <pchpr.00@list.ru>

@dylandreimerink dylandreimerink left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@dylandreimerink
dylandreimerink merged commit 9e37715 into cilium:main Aug 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants