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

@ -6,6 +6,7 @@
package objfile
import (
"debug/dwarf"
"debug/gosym"
"fmt"
"os"
@ -17,6 +18,7 @@ type rawFile interface {
pcln() (textStart uint64, symtab, pclntab []byte, err error)
text() (textStart uint64, text []byte, err error)
goarch() string
dwarf() (*dwarf.Data, error)
}
// A File is an opened executable file.
@ -92,3 +94,9 @@ func (f *File) Text() (uint64, []byte, error) {
func (f *File) GOARCH() string {
return f.raw.goarch()
}
// DWARF returns DWARF debug data for the file, if any.
// This is for cmd/pprof to locate cgo functions.
func (f *File) DWARF() (*dwarf.Data, error) {
return f.raw.dwarf()
}