From 28afa5b1761ba6bb51a4c831e9ee0b9812de8bc5 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Mon, 11 Jul 2022 11:58:39 +0300 Subject: runtime/pprof: add memory mapping info for Windows Fixes #43296 Change-Id: Ib277c2e82c95f71a7a9b7fe1b22215ead7a54a88 Reviewed-on: https://go-review.googlesource.com/c/go/+/416975 Run-TryBot: Alex Brainman Reviewed-by: Michael Pratt Reviewed-by: Alex Brainman Reviewed-by: Than McIntosh --- src/runtime/pprof/proto.go | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/runtime/pprof/proto.go') diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go index 085027cd98..9c82925165 100644 --- a/src/runtime/pprof/proto.go +++ b/src/runtime/pprof/proto.go @@ -10,7 +10,6 @@ import ( "fmt" "internal/abi" "io" - "os" "runtime" "strconv" "strings" @@ -46,10 +45,11 @@ type profileBuilder struct { type memMap struct { // initialized as reading mapping - start uintptr - end uintptr - offset uint64 - file, buildID string + start uintptr // Address at which the binary (or DLL) is loaded into memory. + end uintptr // The limit of the address range occupied by this mapping. + offset uint64 // Offset in the binary that corresponds to the first mapped address. + file string // The object this entry is loaded from. + buildID string // A string that uniquely identifies a particular program version with high probability. funcs symbolizeFlag fake bool // map entry was faked; /proc/self/maps wasn't available @@ -640,20 +640,6 @@ func (b *profileBuilder) emitLocation() uint64 { return id } -// readMapping reads /proc/self/maps and writes mappings to b.pb. -// It saves the address ranges of the mappings in b.mem for use -// when emitting locations. -func (b *profileBuilder) readMapping() { - data, _ := os.ReadFile("/proc/self/maps") - parseProcSelfMaps(data, b.addMapping) - if len(b.mem) == 0 { // pprof expects a map entry, so fake one. - b.addMappingEntry(0, 0, 0, "", "", true) - // TODO(hyangah): make addMapping return *memMap or - // take a memMap struct, and get rid of addMappingEntry - // that takes a bunch of positional arguments. - } -} - var space = []byte(" ") var newline = []byte("\n") -- cgit v1.3-5-g9baa