diff --git a/README.md b/README.md index 17dcd2d..5f98997 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/dwarf.go b/dwarf.go index b0a74fb..1fc8477 100644 --- a/dwarf.go +++ b/dwarf.go @@ -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}