Debian Codegraph @

src/runtime/pprof/proto_other.go

raw
1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build !windows && !darwin
6
7 package pprof
8
9 import (
10 "errors"
11 "os"
12 )
13
14 // readMapping reads /proc/self/maps and writes mappings to b.pb.
15 // It saves the address ranges of the mappings in b.mem for use
16 // when emitting locations.
17 func (b *profileBuilder) readMapping() {
18 data, _ := os.ReadFile("/proc/self/maps")
19 parseProcSelfMaps(data, b.addMapping)
20 if len(b.mem) == 0 { // pprof expects a map entry, so fake one.
21 b.addMappingEntry(0, 0, 0, "", "", true)
22 // TODO(hyangah): make addMapping return *memMap or
23 // take a memMap struct, and get rid of addMappingEntry
24 // that takes a bunch of positional arguments.
25 }
26 }
27
28 func readMainModuleMapping() (start, end uint64, exe, buildID string, err error) {
29 return 0, 0, "", "", errors.New("not implemented")
30 }