I see this issue:
https://github.com/golang/go/issues/19431
In the mentioned PR, Russ add the code to parse /proc/<pid>/maps to get the executable filename, and then read it to parse the section to get the GNU build id, rather than the go build id, .... see the function: func elfBuildID(file string) (string, error)
It will record the GNU build id in the generated pprof profile.
- go build , the linker will create segments like this:
01 .note.go.builid
02 .text .note.go.buildid
- go build -ldflags "-B gobuilid", the linker will create segment like this:
01 .note.go.builid
02 .text .note.gnu.build-id .note.go.buildid
So far, I think there's no any go internal tools read them directly, to get the GNU build id and go build id are achieved by parse the ELF sections.
---
So why does the linker create segment like these to load the .note.go.build and .note.gnu.build-id? To generate the core or memory dump to include the GNU build id and the go build id?
But if we can't get the matched executable, we can't get the ELF sections and segments info, we don't know the loaded address, we still cannot parse the memory dump area to get the right build id value.
Please help.