Skip to content

Commit

Permalink
fix error handling (#146)
Browse files Browse the repository at this point in the history
Signed-off-by: grantseltzer <grantseltzer@gmail.com>
  • Loading branch information
grantseltzer committed Apr 14, 2022
1 parent f36c6ff commit 3cddef5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions helpers/elf.go
Expand Up @@ -18,11 +18,8 @@ func SymbolToOffset(path, symbol string) (uint32, error) {
dynamicSymbols, dynamicSymbolsErr := f.DynamicSymbols()

// Only if we failed getting both regular and dynamic symbols - then we abort.
if regularSymbolsErr != nil {
return 0, fmt.Errorf("could not open symbol sections to resolve symbol offset: %w", regularSymbolsErr)
}
if dynamicSymbolsErr != nil {
return 0, fmt.Errorf("could not open symbol sections to resolve symbol offset: %w", dynamicSymbolsErr)
if regularSymbolsErr != nil && dynamicSymbolsErr != nil {
return 0, fmt.Errorf("could not open regular or dynamic symbol sections to resolve symbol offset: %w %s", regularSymbolsErr, dynamicSymbolsErr)
}

// Concatenating into a single list.
Expand Down

0 comments on commit 3cddef5

Please sign in to comment.