]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/pprof: remove round-to-file-start adjustment
authorKeith Randall <khr@golang.org>
Tue, 16 Aug 2022 19:35:36 +0000 (12:35 -0700)
committerKeith Randall <khr@golang.org>
Tue, 23 Aug 2022 23:11:53 +0000 (23:11 +0000)
This causes a problem in the test sometimes. With a mapping like:

00400000-00411000 r--p 00000000 fe:01 4459044                            /tmp/go-build1710804385/b001/pprof.test
00411000-00645000 r-xp 00011000 fe:01 4459044                            /tmp/go-build1710804385/b001/pprof.test

The removed code would make the first mapping 0x400000-0x645000. Tests
then grab the first few addresses to use as PCs, thinking they are in
an executable range. But those addresses are really not in an
executable range, causing the tests to fail.

Change-Id: I5a69d0259d1fd70ff9745df1cbad4d54c5898e7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/424295
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Keith Randall <khr@golang.org>

src/internal/profile/legacy_profile.go
src/runtime/pprof/proto.go

index fee420986eee4402b1894a878088b44e14241be4..0ac350a8884aa7d8666ec83e2197868cdce9e4a7 100644 (file)
@@ -192,14 +192,6 @@ func (p *Profile) remapMappingIDs() {
                }
        }
 
-       // Subtract the offset from the start of the main mapping if it
-       // ends up at a recognizable start address.
-       const expectedStart = 0x400000
-       if m := p.Mapping[0]; m.Start-m.Offset == expectedStart {
-               m.Start = expectedStart
-               m.Offset = 0
-       }
-
        for _, l := range p.Location {
                if a := l.Address; a != 0 {
                        for _, m := range p.Mapping {
index 9c8292516584da6741805e42e3a12cea00e84c98..7e3c5f1c184d662d83c245ddfbe3e81593567fc9 100644 (file)
@@ -721,13 +721,12 @@ func parseProcSelfMaps(data []byte, addMapping func(lo, hi, offset uint64, file,
                        continue
                }
 
-               // TODO: pprof's remapMappingIDs makes two adjustments:
+               // TODO: pprof's remapMappingIDs makes one adjustment:
                // 1. If there is an /anon_hugepage mapping first and it is
                // consecutive to a next mapping, drop the /anon_hugepage.
-               // 2. If start-offset = 0x400000, change start to 0x400000 and offset to 0.
-               // There's no indication why either of these is needed.
-               // Let's try not doing these and see what breaks.
-               // If we do need them, they would go here, before we
+               // There's no indication why this is needed.
+               // Let's try not doing this and see what breaks.
+               // If we do need it, it would go here, before we
                // enter the mappings into b.mem in the first place.
 
                buildID, _ := elfBuildID(file)