Source File
elf.go
Belonging Package
runtime/pprof
if [0] != 0x7F || [1] != 'E' || [2] != 'L' || [3] != 'F' {
return "", errBadELF
}
var binary.ByteOrder
switch [5] {
default:
return "", errBadELF
case 1: // little-endian
= binary.LittleEndian
case 2: // big-endian
= binary.BigEndian
}
var int
var , int64
switch [4] {
default:
return "", errBadELF
case 1: // 32-bit file header
= int64(.Uint32([32:]))
= int64(.Uint16([46:]))
if != 40 {
return "", errBadELF
}
= int(.Uint16([48:]))
case 2: // 64-bit file header
= int64(.Uint64([40:]))
= int64(.Uint16([58:]))
if != 64 {
return "", errBadELF
}
= int(.Uint16([60:]))
}
for := 0; < ; ++ {
if , := .ReadAt([:], +int64()*); != nil {
return "",
}
if := .Uint32([4:]); != 7 { // SHT_NOTE
continue
}
var , int64
= int64(.Uint64([24:]))
= int64(.Uint64([32:]))
}
+=
for < {
if , := .ReadAt([:16], ); != nil { // room for header + name GNU\x00
return "",
}
:= int(.Uint32([0:]))
:= int(.Uint32([4:]))
:= int(.Uint32([8:]))
:= + int64(12+(+3)&^3)
= + int64((+3)&^3)
if != 4 || != 3 || [12] != 'G' || [13] != 'N' || [14] != 'U' || [15] != '\x00' { // want name GNU\x00 type 3 (NT_GNU_BUILD_ID)
continue
}
if > len() {
return "", errBadELF
}
if , := .ReadAt([:], ); != nil {
return "",
}
return fmt.Sprintf("%x", [:]), nil
}
}
return "", errNoBuildID
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |