summaryrefslogtreecommitdiff
path: root/src/pkg/debug/macho/file.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/debug/macho/file.go')
-rw-r--r--src/pkg/debug/macho/file.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/pkg/debug/macho/file.go b/src/pkg/debug/macho/file.go
index 721a4c416..fa73a315c 100644
--- a/src/pkg/debug/macho/file.go
+++ b/src/pkg/debug/macho/file.go
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package macho implements access to Mach-O object files, as defined by
-// http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html.
+// Package macho implements access to Mach-O object files.
package macho
// High level access to low level data structures.
@@ -12,6 +11,7 @@ import (
"bytes"
"debug/dwarf"
"encoding/binary"
+ "errors"
"fmt"
"io"
"os"
@@ -71,7 +71,7 @@ type Segment struct {
}
// Data reads and returns the contents of the segment.
-func (s *Segment) Data() ([]byte, os.Error) {
+func (s *Segment) Data() ([]byte, error) {
dat := make([]byte, s.sr.Size())
n, err := s.sr.ReadAt(dat, 0)
return dat[0:n], err
@@ -106,7 +106,7 @@ type Section struct {
}
// Data reads and returns the contents of the Mach-O section.
-func (s *Section) Data() ([]byte, os.Error) {
+func (s *Section) Data() ([]byte, error) {
dat := make([]byte, s.sr.Size())
n, err := s.sr.ReadAt(dat, 0)
return dat[0:n], err
@@ -148,7 +148,7 @@ type FormatError struct {
val interface{}
}
-func (e *FormatError) String() string {
+func (e *FormatError) Error() string {
msg := e.msg
if e.val != nil {
msg += fmt.Sprintf(" '%v'", e.val)
@@ -158,7 +158,7 @@ func (e *FormatError) String() string {
}
// Open opens the named file using os.Open and prepares it for use as a Mach-O binary.
-func Open(name string) (*File, os.Error) {
+func Open(name string) (*File, error) {
f, err := os.Open(name)
if err != nil {
return nil, err
@@ -175,8 +175,8 @@ func Open(name string) (*File, os.Error) {
// Close closes the File.
// If the File was created using NewFile directly instead of Open,
// Close has no effect.
-func (f *File) Close() os.Error {
- var err os.Error
+func (f *File) Close() error {
+ var err error
if f.closer != nil {
err = f.closer.Close()
f.closer = nil
@@ -186,7 +186,7 @@ func (f *File) Close() os.Error {
// NewFile creates a new File for accessing a Mach-O binary in an underlying reader.
// The Mach-O binary is expected to start at position 0 in the ReaderAt.
-func NewFile(r io.ReaderAt) (*File, os.Error) {
+func NewFile(r io.ReaderAt) (*File, error) {
f := new(File)
sr := io.NewSectionReader(r, 0, 1<<63-1)
@@ -391,7 +391,7 @@ func NewFile(r io.ReaderAt) (*File, os.Error) {
return f, nil
}
-func (f *File) parseSymtab(symdat, strtab, cmddat []byte, hdr *SymtabCmd, offset int64) (*Symtab, os.Error) {
+func (f *File) parseSymtab(symdat, strtab, cmddat []byte, hdr *SymtabCmd, offset int64) (*Symtab, error) {
bo := f.ByteOrder
symtab := make([]Symbol, hdr.Nsyms)
b := bytes.NewBuffer(symdat)
@@ -463,7 +463,7 @@ func (f *File) Section(name string) *Section {
}
// DWARF returns the DWARF debug information for the Mach-O file.
-func (f *File) DWARF() (*dwarf.Data, os.Error) {
+func (f *File) DWARF() (*dwarf.Data, error) {
// There are many other DWARF sections, but these
// are the required ones, and the debug/dwarf package
// does not use the others, so don't bother loading them.
@@ -473,7 +473,7 @@ func (f *File) DWARF() (*dwarf.Data, os.Error) {
name = "__debug_" + name
s := f.Section(name)
if s == nil {
- return nil, os.NewError("missing Mach-O section " + name)
+ return nil, errors.New("missing Mach-O section " + name)
}
b, err := s.Data()
if err != nil && uint64(len(b)) < s.Size {
@@ -489,7 +489,7 @@ func (f *File) DWARF() (*dwarf.Data, os.Error) {
// ImportedSymbols returns the names of all symbols
// referred to by the binary f that are expected to be
// satisfied by other libraries at dynamic load time.
-func (f *File) ImportedSymbols() ([]string, os.Error) {
+func (f *File) ImportedSymbols() ([]string, error) {
if f.Dysymtab == nil || f.Symtab == nil {
return nil, &FormatError{0, "missing symbol table", nil}
}
@@ -506,7 +506,7 @@ func (f *File) ImportedSymbols() ([]string, os.Error) {
// ImportedLibraries returns the paths of all libraries
// referred to by the binary f that are expected to be
// linked with the binary at dynamic link time.
-func (f *File) ImportedLibraries() ([]string, os.Error) {
+func (f *File) ImportedLibraries() ([]string, error) {
var all []string
for _, l := range f.Loads {
if lib, ok := l.(*Dylib); ok {