diff options
| author | Cosmos Nicolaou <cosmos.nicolaou@gmail.com> | 2023-06-14 14:33:43 -0700 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2023-08-03 16:07:59 +0000 |
| commit | b7c826d2c4576dbe04a79ab7d0dfa03c722c0ab9 (patch) | |
| tree | 3da7ecc90e526b16339b493d61a07d91f7b87dab /src/cmd/internal/objfile | |
| parent | d50272a8c17920d0eac2d765194d4cd0355a1d34 (diff) | |
| download | go-b7c826d2c4576dbe04a79ab7d0dfa03c722c0ab9.tar.xz | |
runtime,runtime/pprof: get memory mappings on darwin.
Displaying assembly language has never worked for Apple Silicon
macs (see #50891). This change uses mach_vm_region to obtain the
necessary VM mappings to allow for locating assembly instructions
for a cpu profile.
Fixes #50891
Change-Id: Ib968c55a19b481b82f63337276b552f3b18f69d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/503919
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/internal/objfile')
| -rw-r--r-- | src/cmd/internal/objfile/macho.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/internal/objfile/macho.go b/src/cmd/internal/objfile/macho.go index 1d6963f7c4..c92497527a 100644 --- a/src/cmd/internal/objfile/macho.go +++ b/src/cmd/internal/objfile/macho.go @@ -128,6 +128,9 @@ func (x uint64s) Swap(i, j int) { x[i], x[j] = x[j], x[i] } func (x uint64s) Less(i, j int) bool { return x[i] < x[j] } func (f *machoFile) loadAddress() (uint64, error) { + if seg := f.macho.Segment("__TEXT"); seg != nil { + return seg.Addr, nil + } return 0, fmt.Errorf("unknown load address") } |
