Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/debug/elf/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ type Symbol struct {
* ELF reader
*/

// FormatError is returned if the data does not have the correct format for an ELF.
type FormatError struct {
off int64
msg string
Expand All @@ -246,6 +247,9 @@ func (e *FormatError) Error() string {
}

// Open opens the named file using [os.Open] and prepares it for use as an ELF binary.
//
// Will return [*FormatError] if the file does not have the correct format for an ELF or
// [*os.PathError] if an error is encountered opening or reading the file.
func Open(name string) (*File, error) {
f, err := os.Open(name)
if err != nil {
Expand Down