MCPcopy Create free account
hub / github.com/google/pprof / FindTextProgHeader

Function FindTextProgHeader

internal/elfexec/elfexec.go:287–299  ·  view source on GitHub ↗

FindTextProgHeader finds the program segment header containing the .text section or nil if the segment cannot be found.

(f *elf.File)

Source from the content-addressed store, hash-verified

285// FindTextProgHeader finds the program segment header containing the .text
286// section or nil if the segment cannot be found.
287func FindTextProgHeader(f *elf.File) *elf.ProgHeader {
288 for _, s := range f.Sections {
289 if s.Name == ".text" {
290 // Find the LOAD segment containing the .text section.
291 for _, p := range f.Progs {
292 if p.Type == elf.PT_LOAD && p.Flags&elf.PF_X != 0 && s.Addr >= p.Vaddr && s.Addr < p.Vaddr+p.Memsz {
293 return &p.ProgHeader
294 }
295 }
296 }
297 }
298 return nil
299}
300
301// ProgramHeadersForMapping returns the program segment headers that overlap
302// the runtime mapping with file offset mapOff and memory size mapSz. We skip

Callers 2

openELFMethod · 0.92
findProgramHeaderMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…