cmd/pprof: use DWARF info to lookup unknown PC addresses

Test to follow in a separate CL that arranges for the runtime package to
store non-Go addresses in a CPU profile.

Change-Id: I33ce1d66b77340b1e62b54505fc9b1abcec108a9
Reviewed-on: https://go-review.googlesource.com/21055
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-03-23 17:10:18 -07:00
parent 4b209dbf0b
commit b4117995e3
7 changed files with 123 additions and 7 deletions

View file

@ -7,6 +7,7 @@
package objfile
import (
"debug/dwarf"
"debug/macho"
"fmt"
"os"
@ -123,3 +124,7 @@ type uint64s []uint64
func (x uint64s) Len() int { return len(x) }
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) dwarf() (*dwarf.Data, error) {
return f.macho.DWARF()
}