$75 GRAYBYTE WORDPRESS FILE MANAGER $65

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/lib/golang/src/runtime/pprof/

HOME
Current File : /lib/golang/src/runtime/pprof//elf.go
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package pprof

import (
	"encoding/binary"
	"errors"
	"fmt"
	"os"
)

var (
	errBadELF    = errors.New("malformed ELF binary")
	errNoBuildID = errors.New("no NT_GNU_BUILD_ID found in ELF binary")
)

// elfBuildID returns the GNU build ID of the named ELF binary,
// without introducing a dependency on debug/elf and its dependencies.
func elfBuildID(file string) (string, error) {
	buf := make([]byte, 256)
	f, err := os.Open(file)
	if err != nil {
		return "", err
	}
	defer f.Close()

	if _, err := f.ReadAt(buf[:64], 0); err != nil {
		return "", err
	}

	// ELF file begins with \x7F E L F.
	if buf[0] != 0x7F || buf[1] != 'E' || buf[2] != 'L' || buf[3] != 'F' {
		return "", errBadELF
	}

	var byteOrder binary.ByteOrder
	switch buf[5] {
	default:
		return "", errBadELF
	case 1: // little-endian
		byteOrder = binary.LittleEndian
	case 2: // big-endian
		byteOrder = binary.BigEndian
	}

	var shnum int
	var shoff, shentsize int64
	switch buf[4] {
	default:
		return "", errBadELF
	case 1: // 32-bit file header
		shoff = int64(byteOrder.Uint32(buf[32:]))
		shentsize = int64(byteOrder.Uint16(buf[46:]))
		if shentsize != 40 {
			return "", errBadELF
		}
		shnum = int(byteOrder.Uint16(buf[48:]))
	case 2: // 64-bit file header
		shoff = int64(byteOrder.Uint64(buf[40:]))
		shentsize = int64(byteOrder.Uint16(buf[58:]))
		if shentsize != 64 {
			return "", errBadELF
		}
		shnum = int(byteOrder.Uint16(buf[60:]))
	}

	for i := 0; i < shnum; i++ {
		if _, err := f.ReadAt(buf[:shentsize], shoff+int64(i)*shentsize); err != nil {
			return "", err
		}
		if typ := byteOrder.Uint32(buf[4:]); typ != 7 { // SHT_NOTE
			continue
		}
		var off, size int64
		if shentsize == 40 {
			// 32-bit section header
			off = int64(byteOrder.Uint32(buf[16:]))
			size = int64(byteOrder.Uint32(buf[20:]))
		} else {
			// 64-bit section header
			off = int64(byteOrder.Uint64(buf[24:]))
			size = int64(byteOrder.Uint64(buf[32:]))
		}
		size += off
		for off < size {
			if _, err := f.ReadAt(buf[:16], off); err != nil { // room for header + name GNU\x00
				return "", err
			}
			nameSize := int(byteOrder.Uint32(buf[0:]))
			descSize := int(byteOrder.Uint32(buf[4:]))
			noteType := int(byteOrder.Uint32(buf[8:]))
			descOff := off + int64(12+(nameSize+3)&^3)
			off = descOff + int64((descSize+3)&^3)
			if nameSize != 4 || noteType != 3 || buf[12] != 'G' || buf[13] != 'N' || buf[14] != 'U' || buf[15] != '\x00' { // want name GNU\x00 type 3 (NT_GNU_BUILD_ID)
				continue
			}
			if descSize > len(buf) {
				return "", errBadELF
			}
			if _, err := f.ReadAt(buf[:descSize], descOff); err != nil {
				return "", err
			}
			return fmt.Sprintf("%x", buf[:descSize]), nil
		}
	}
	return "", errNoBuildID
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.34 PM
root / root
0755
defs_darwin.go
0.752 KB
4 Dec 2025 6.06 PM
root / root
0644
defs_darwin_amd64.go
0.595 KB
4 Dec 2025 6.06 PM
root / root
0644
defs_darwin_arm64.go
0.593 KB
4 Dec 2025 6.06 PM
root / root
0644
elf.go
2.794 KB
4 Dec 2025 6.06 PM
root / root
0644
label.go
4.02 KB
4 Dec 2025 6.06 PM
root / root
0644
map.go
1.938 KB
4 Dec 2025 6.06 PM
root / root
0644
pe.go
0.523 KB
4 Dec 2025 6.06 PM
root / root
0644
pprof.go
31.134 KB
4 Dec 2025 6.06 PM
root / root
0644
pprof_norusage.go
0.302 KB
4 Dec 2025 6.06 PM
root / root
0644
pprof_rusage.go
0.773 KB
4 Dec 2025 6.06 PM
root / root
0644
pprof_windows.go
0.493 KB
4 Dec 2025 6.06 PM
root / root
0644
proto.go
25.951 KB
4 Dec 2025 6.06 PM
root / root
0644
proto_darwin.go
1.028 KB
4 Dec 2025 6.06 PM
root / root
0644
proto_other.go
0.906 KB
4 Dec 2025 6.06 PM
root / root
0644
proto_windows.go
2.165 KB
4 Dec 2025 6.06 PM
root / root
0644
protobuf.go
2.504 KB
4 Dec 2025 6.06 PM
root / root
0644
protomem.go
2.986 KB
4 Dec 2025 6.06 PM
root / root
0644
runtime.go
1.762 KB
4 Dec 2025 6.06 PM
root / root
0644
vminfo_darwin.go
1.806 KB
4 Dec 2025 6.06 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF