aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorCosmos Nicolaou <cosmos.nicolaou@gmail.com>2023-06-14 14:33:43 -0700
committerCherry Mui <cherryyz@google.com>2023-08-03 16:07:59 +0000
commitb7c826d2c4576dbe04a79ab7d0dfa03c722c0ab9 (patch)
tree3da7ecc90e526b16339b493d61a07d91f7b87dab /src/cmd
parentd50272a8c17920d0eac2d765194d4cd0355a1d34 (diff)
downloadgo-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')
-rw-r--r--src/cmd/internal/objfile/macho.go3
-rw-r--r--src/cmd/pprof/pprof_test.go3
2 files changed, 4 insertions, 2 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")
}
diff --git a/src/cmd/pprof/pprof_test.go b/src/cmd/pprof/pprof_test.go
index 2a651dda5f..494cd8f24c 100644
--- a/src/cmd/pprof/pprof_test.go
+++ b/src/cmd/pprof/pprof_test.go
@@ -76,8 +76,7 @@ func mustHaveDisasm(t *testing.T) {
// pprof can only disassemble PIE on some platforms.
// Skip the ones it can't handle yet.
- if (runtime.GOOS == "darwin" && runtime.GOARCH == "arm64") ||
- (runtime.GOOS == "android" && runtime.GOARCH == "arm") {
+ if runtime.GOOS == "android" && runtime.GOARCH == "arm" {
t.Skipf("skipping on %s/%s, issue 46639", runtime.GOOS, runtime.GOARCH)
}
}