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.
On Friday, March 7, 2025 at 11:22:02 AM UTC+8 Zhang Jie (Kn) wrote:
> From the output of `readelf -l <app>` , we can see `.note.go.buildid` and
> `.text` sections are both loaded.
>
> I want to know why `.note.go.buildid` is loaded, it seems go source code
> doesn't read it at all.
>
> I read the discussion here: https://github.com/golang/go/issues/68652.
> Looks like gobuildid should be used only in go build tools. I searched and
> only `go tool pprof` uses the `buildid`, but it is the GNU buildID rather
> than go buildID
>
> ps: `ParseMemoryMap -> elfBuildID`, `elfBuildID` only read the GNU
> buildID.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/c6011c6b-4fd1-4867-a963-6afe4af2ce95n%40googlegroups.com.