golang/go

cmd/compile: add epilogue_begin to DWARF line info

Open

#69,329 opened on Sep 6, 2024

View on GitHub
 (4 comments) (1 reaction) (0 assignees)Go (19,008 forks)batch import
FeatureRequestNeedsInvestigationcompiler/runtimehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Go does not currently (as of go1.23) emit epilogue_begin markers around where functions return. It does emit prologue_end.

The motivation here is that go is not friendly to things like ebpf return probes (uretprobe) because they inject a call frame into the stack (see https://github.com/iovisor/bcc/issues/1320).

What folks do instead is simulate these return probes by finding all of the returns sites by parsing the text of the program (see https://github.com/iovisor/bcc/issues/1320#issuecomment-982020012). A more general approach that doesn't require access to the binary would be to store the relevant information in the line info.

Contributor guide