Skip to content

Commit

Permalink
dwarf: relax required sections (#68)
Browse files Browse the repository at this point in the history
Not all sections are required to successfully use DWARF. For example, gc
doesn't need debug_str. Instead, only skip DWARF symbolizer if the
format is actually invalid. cc @chriso
  • Loading branch information
pelletier authored May 11, 2023
1 parent f6a4710 commit 487eb3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ application performance.

- CPU: calls sampling and on-CPU time.
- Memory: allocations (see below).
- DWARF support (demangling, source-level profiling)
- DWARF support (demangling, source-level profiling).
- Integrated pprof server.
- Library and CLI interfaces.

Expand Down
19 changes: 3 additions & 16 deletions dwarf.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,11 @@ func newDwarfmapper(sections []api.CustomSection) (*dwarfmapper, error) {
}
}

if info == nil {
return nil, fmt.Errorf("dwarf: missing section: .debug_info")
}
if line == nil {
return nil, fmt.Errorf("dwarf: missing section: .debug_line")
}
if str == nil {
return nil, fmt.Errorf("dwarf: missing section: .debug_str")
}
if abbrev == nil {
return nil, fmt.Errorf("dwarf: missing section: .debug_abbrev")
}
if ranges == nil {
return nil, fmt.Errorf("dwarf: missing section: .debug_ranges")
d, err := dwarf.New(abbrev, nil, nil, info, line, nil, ranges, str)
if err != nil {
return nil, fmt.Errorf("dwarf: %w", err)
}

d, _ := dwarf.New(abbrev, nil, nil, info, line, nil, ranges, str)

r := d.Reader()

p := dwarfparser{d: d, r: r}
Expand Down

0 comments on commit 487eb3f

Please sign in to comment.