Skip to content

debug/plan9obj: add ErrNoSymbols sentinel for case that no symbol section exists #48052

@kortschak

Description

@kortschak

The elf package provide a sentinel error, ErrNoSymbols for the case that Symbols or DynamicSymbols cannot return a symbol list because the section is empty. The same situation is handled in plan9obj by returning a new error for this case. For PE/Mach-O there is no issue since access to the symbols is via direct access to a slice field.

Because of this, it's either necessary to do an error string comparison or re-call f.Section("syms") to check whether is was nil, repeating work that has already been done.

Originally posted to golan-nuts: https://groups.google.com/g/golang-nuts/c/HUpyQwYVKZE/m/uEOw3N4JGwAJ, but filing here to avoid issue being lost.

I am happy to send a PR if this is acceptable.

What version of Go are you using (go version)?

$ go version
go version go1.17 linux/amd64

Does this issue reproduce with the latest release?

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions