aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/pprof
diff options
context:
space:
mode:
authorapocelipes <seve3r@outlook.com>2025-04-08 10:00:13 +0000
committerMichael Pratt <mpratt@google.com>2025-04-08 07:47:16 -0700
commit38a2a3c7ce156e01f8980cb97912b7067709aaa3 (patch)
tree3d3701b563e81640ba6a3376c098c16cb556a8e5 /src/runtime/pprof
parent14b15a2beaed423ba6b6c97fa5983bd57999038e (diff)
downloadgo-38a2a3c7ce156e01f8980cb97912b7067709aaa3.tar.xz
runtime: use internal/byteorder
To simplify the code. Change-Id: Ib1af5009cc25bb29fd26fdb7b29ff4579f0150aa GitHub-Last-Rev: f698a8a771ac8c6ecb745ea4c27a7c677c1789d1 GitHub-Pull-Request: golang/go#73255 Reviewed-on: https://go-review.googlesource.com/c/go/+/663735 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/pprof')
-rw-r--r--src/runtime/pprof/vminfo_darwin.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/runtime/pprof/vminfo_darwin.go b/src/runtime/pprof/vminfo_darwin.go
index 35b9e6d487..610de0a2f0 100644
--- a/src/runtime/pprof/vminfo_darwin.go
+++ b/src/runtime/pprof/vminfo_darwin.go
@@ -5,6 +5,7 @@
package pprof
import (
+ "internal/byteorder"
"os"
"unsafe"
)
@@ -39,7 +40,7 @@ func machVMInfo(addMapping func(lo, hi, offset uint64, file, buildID string)) bo
// offset is usually 0.
addMapping(addr,
addr+memRegionSize,
- read64(&info.Offset),
+ byteorder.LEUint64(info.Offset[:]),
regionFilename(addr),
"")
added = true
@@ -48,11 +49,6 @@ func machVMInfo(addMapping func(lo, hi, offset uint64, file, buildID string)) bo
}
}
-func read64(p *[8]byte) uint64 {
- // all supported darwin platforms are little endian
- return uint64(p[0]) | uint64(p[1])<<8 | uint64(p[2])<<16 | uint64(p[3])<<24 | uint64(p[4])<<32 | uint64(p[5])<<40 | uint64(p[6])<<48 | uint64(p[7])<<56
-}
-
func regionFilename(address uint64) string {
buf := make([]byte, _MAXPATHLEN)
r := proc_regionfilename(