mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime/pprof, cmd/pprof: fix profiling for PIE
In order to support pprof for position independent executables, pprof needs to adjust the PC addresses stored in the profile by the address at which the program is loaded. The legacy profiling support which we use already supports recording the GNU/Linux /proc/self/maps data immediately after the CPU samples, so do that. Also change the pprof symbolizer to use the information, if available, when looking up addresses in the Go pcline data. Fixes #15714. Change-Id: I4bf679210ef7c51d85cf873c968ce82db8898e3e Reviewed-on: https://go-review.googlesource.com/23525 Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
This commit is contained in:
parent
87ee12cece
commit
4223294eab
12 changed files with 128 additions and 15 deletions
|
|
@ -18,6 +18,7 @@ type rawFile interface {
|
|||
pcln() (textStart uint64, symtab, pclntab []byte, err error)
|
||||
text() (textStart uint64, text []byte, err error)
|
||||
goarch() string
|
||||
loadAddress() (uint64, error)
|
||||
dwarf() (*dwarf.Data, error)
|
||||
}
|
||||
|
||||
|
|
@ -95,6 +96,13 @@ func (f *File) GOARCH() string {
|
|||
return f.raw.goarch()
|
||||
}
|
||||
|
||||
// LoadAddress returns the expected load address of the file.
|
||||
// This differs from the actual load address for a position-independent
|
||||
// executable.
|
||||
func (f *File) LoadAddress() (uint64, error) {
|
||||
return f.raw.loadAddress()
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue