diff options
| author | Egon Elbre <egonelbre@gmail.com> | 2022-07-11 11:58:39 +0300 |
|---|---|---|
| committer | Alex Brainman <alex.brainman@gmail.com> | 2022-08-20 00:18:04 +0000 |
| commit | 28afa5b1761ba6bb51a4c831e9ee0b9812de8bc5 (patch) | |
| tree | 9b4a8640b9a90acb40016545625444d3eca5d56b /src/runtime/pprof/proto.go | |
| parent | d05ce23756573c6dc2c5026d936f2ef6ac140ee2 (diff) | |
| download | go-28afa5b1761ba6bb51a4c831e9ee0b9812de8bc5.tar.xz | |
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 <alex.brainman@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/runtime/pprof/proto.go')
| -rw-r--r-- | src/runtime/pprof/proto.go | 24 |
1 files changed, 5 insertions, 19 deletions
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") |
