summaryrefslogtreecommitdiff
path: root/src/pkg/debug
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/debug')
-rw-r--r--src/pkg/debug/dwarf/buf.go4
-rw-r--r--src/pkg/debug/dwarf/type.go44
-rw-r--r--src/pkg/debug/dwarf/type_test.go4
-rw-r--r--src/pkg/debug/elf/elf.go220
-rw-r--r--src/pkg/debug/elf/file.go8
-rw-r--r--src/pkg/debug/gosym/symtab.go8
-rw-r--r--src/pkg/debug/macho/file.go12
-rw-r--r--src/pkg/debug/macho/macho.go16
-rw-r--r--src/pkg/debug/proc/proc.go40
-rw-r--r--src/pkg/debug/proc/proc_linux.go20
-rw-r--r--src/pkg/debug/proc/regs_linux_386.go16
-rw-r--r--src/pkg/debug/proc/regs_linux_amd64.go12
-rw-r--r--src/pkg/debug/proc/regs_linux_arm.go32
13 files changed, 109 insertions, 327 deletions
diff --git a/src/pkg/debug/dwarf/buf.go b/src/pkg/debug/dwarf/buf.go
index 34880a5d5..87576e65c 100644
--- a/src/pkg/debug/dwarf/buf.go
+++ b/src/pkg/debug/dwarf/buf.go
@@ -49,9 +49,7 @@ func (b *buf) bytes(n int) []byte {
return data;
}
-func (b *buf) skip(n int) {
- b.bytes(n);
-}
+func (b *buf) skip(n int) { b.bytes(n) }
func (b *buf) string() string {
for i := 0; i < len(b.data); i++ {
diff --git a/src/pkg/debug/dwarf/type.go b/src/pkg/debug/dwarf/type.go
index 91334bdf2..77d24f5d2 100644
--- a/src/pkg/debug/dwarf/type.go
+++ b/src/pkg/debug/dwarf/type.go
@@ -29,13 +29,9 @@ type CommonType struct {
Name string; // name that can be used to refer to type
}
-func (c *CommonType) Common() *CommonType {
- return c;
-}
+func (c *CommonType) Common() *CommonType { return c }
-func (c *CommonType) Size() int64 {
- return c.ByteSize;
-}
+func (c *CommonType) Size() int64 { return c.ByteSize }
// Basic types
@@ -46,9 +42,7 @@ type BasicType struct {
BitOffset int64;
}
-func (b *BasicType) Basic() *BasicType {
- return b;
-}
+func (b *BasicType) Basic() *BasicType { return b }
func (t *BasicType) String() string {
if t.Name != "" {
@@ -106,13 +100,9 @@ type QualType struct {
Type Type;
}
-func (t *QualType) String() string {
- return t.Qual + " " + t.Type.String();
-}
+func (t *QualType) String() string { return t.Qual + " " + t.Type.String() }
-func (t *QualType) Size() int64 {
- return t.Type.Size();
-}
+func (t *QualType) Size() int64 { return t.Type.Size() }
// An ArrayType represents a fixed size array type.
type ArrayType struct {
@@ -126,18 +116,14 @@ func (t *ArrayType) String() string {
return "[" + strconv.Itoa64(t.Count) + "]" + t.Type.String();
}
-func (t *ArrayType) Size() int64 {
- return t.Count * t.Type.Size();
-}
+func (t *ArrayType) Size() int64 { return t.Count * t.Type.Size() }
// A VoidType represents the C void type.
type VoidType struct {
CommonType;
}
-func (t *VoidType) String() string {
- return "void";
-}
+func (t *VoidType) String() string { return "void" }
// A PtrType represents a pointer type.
type PtrType struct {
@@ -145,9 +131,7 @@ type PtrType struct {
Type Type;
}
-func (t *PtrType) String() string {
- return "*" + t.Type.String();
-}
+func (t *PtrType) String() string { return "*" + t.Type.String() }
// A StructType represents a struct, union, or C++ class type.
type StructType struct {
@@ -258,9 +242,7 @@ type DotDotDotType struct {
CommonType;
}
-func (t *DotDotDotType) String() string {
- return "...";
-}
+func (t *DotDotDotType) String() string { return "..." }
// A TypedefType represents a named type.
type TypedefType struct {
@@ -268,13 +250,9 @@ type TypedefType struct {
Type Type;
}
-func (t *TypedefType) String() string {
- return t.Name;
-}
+func (t *TypedefType) String() string { return t.Name }
-func (t *TypedefType) Size() int64 {
- return t.Type.Size();
-}
+func (t *TypedefType) Size() int64 { return t.Type.Size() }
func (d *Data) Type(off Offset) (Type, os.Error) {
if t, ok := d.typeCache[off]; ok {
diff --git a/src/pkg/debug/dwarf/type_test.go b/src/pkg/debug/dwarf/type_test.go
index 98e444eaf..dcecbe2c3 100644
--- a/src/pkg/debug/dwarf/type_test.go
+++ b/src/pkg/debug/dwarf/type_test.go
@@ -56,9 +56,7 @@ func machoData(t *testing.T, name string) *Data {
}
-func TestTypedefsELF(t *testing.T) {
- testTypedefs(t, elfData(t, "testdata/typedef.elf"));
-}
+func TestTypedefsELF(t *testing.T) { testTypedefs(t, elfData(t, "testdata/typedef.elf")) }
func TestTypedefsMachO(t *testing.T) {
testTypedefs(t, machoData(t, "testdata/typedef.macho"));
diff --git a/src/pkg/debug/elf/elf.go b/src/pkg/debug/elf/elf.go
index 716f10b40..42a240efd 100644
--- a/src/pkg/debug/elf/elf.go
+++ b/src/pkg/debug/elf/elf.go
@@ -73,12 +73,8 @@ var versionStrings = []intName{
intName{1, "EV_CURRENT"},
}
-func (i Version) String() string {
- return stringName(uint32(i), versionStrings, false);
-}
-func (i Version) GoString() string {
- return stringName(uint32(i), versionStrings, true);
-}
+func (i Version) String() string { return stringName(uint32(i), versionStrings, false) }
+func (i Version) GoString() string { return stringName(uint32(i), versionStrings, true) }
// Class is found in Header.Ident[EI_CLASS] and Header.Class.
type Class byte
@@ -95,12 +91,8 @@ var classStrings = []intName{
intName{2, "ELFCLASS64"},
}
-func (i Class) String() string {
- return stringName(uint32(i), classStrings, false);
-}
-func (i Class) GoString() string {
- return stringName(uint32(i), classStrings, true);
-}
+func (i Class) String() string { return stringName(uint32(i), classStrings, false) }
+func (i Class) GoString() string { return stringName(uint32(i), classStrings, true) }
// Data is found in Header.Ident[EI_DATA] and Header.Data.
type Data byte
@@ -117,12 +109,8 @@ var dataStrings = []intName{
intName{2, "ELFDATA2MSB"},
}
-func (i Data) String() string {
- return stringName(uint32(i), dataStrings, false);
-}
-func (i Data) GoString() string {
- return stringName(uint32(i), dataStrings, true);
-}
+func (i Data) String() string { return stringName(uint32(i), dataStrings, false) }
+func (i Data) GoString() string { return stringName(uint32(i), dataStrings, true) }
// OSABI is found in Header.Ident[EI_OSABI] and Header.OSABI.
type OSABI byte
@@ -167,12 +155,8 @@ var osabiStrings = []intName{
intName{255, "ELFOSABI_STANDALONE"},
}
-func (i OSABI) String() string {
- return stringName(uint32(i), osabiStrings, false);
-}
-func (i OSABI) GoString() string {
- return stringName(uint32(i), osabiStrings, true);
-}
+func (i OSABI) String() string { return stringName(uint32(i), osabiStrings, false) }
+func (i OSABI) GoString() string { return stringName(uint32(i), osabiStrings, true) }
// Type is found in Header.Type.
type Type uint16
@@ -201,12 +185,8 @@ var typeStrings = []intName{
intName{0xffff, "ET_HIPROC"},
}
-func (i Type) String() string {
- return stringName(uint32(i), typeStrings, false);
-}
-func (i Type) GoString() string {
- return stringName(uint32(i), typeStrings, true);
-}
+func (i Type) String() string { return stringName(uint32(i), typeStrings, false) }
+func (i Type) GoString() string { return stringName(uint32(i), typeStrings, true) }
// Machine is found in Header.Machine.
type Machine uint16
@@ -315,12 +295,8 @@ var machineStrings = []intName{
intName{0x9026, "EM_ALPHA"},
}
-func (i Machine) String() string {
- return stringName(uint32(i), machineStrings, false);
-}
-func (i Machine) GoString() string {
- return stringName(uint32(i), machineStrings, true);
-}
+func (i Machine) String() string { return stringName(uint32(i), machineStrings, false) }
+func (i Machine) GoString() string { return stringName(uint32(i), machineStrings, true) }
// Special section indices.
type SectionIndex int
@@ -347,12 +323,8 @@ var shnStrings = []intName{
intName{0xffff, "SHN_XINDEX"},
}
-func (i SectionIndex) String() string {
- return stringName(uint32(i), shnStrings, false);
-}
-func (i SectionIndex) GoString() string {
- return stringName(uint32(i), shnStrings, true);
-}
+func (i SectionIndex) String() string { return stringName(uint32(i), shnStrings, false) }
+func (i SectionIndex) GoString() string { return stringName(uint32(i), shnStrings, true) }
// Section type.
type SectionType uint32
@@ -409,12 +381,8 @@ var shtStrings = []intName{
intName{0xffffffff, "SHT_HIUSER"},
}
-func (i SectionType) String() string {
- return stringName(uint32(i), shtStrings, false);
-}
-func (i SectionType) GoString() string {
- return stringName(uint32(i), shtStrings, true);
-}
+func (i SectionType) String() string { return stringName(uint32(i), shtStrings, false) }
+func (i SectionType) GoString() string { return stringName(uint32(i), shtStrings, true) }
// Section flags.
type SectionFlag uint32
@@ -447,12 +415,8 @@ var shfStrings = []intName{
intName{0x400, "SHF_TLS"},
}
-func (i SectionFlag) String() string {
- return flagName(uint32(i), shfStrings, false);
-}
-func (i SectionFlag) GoString() string {
- return flagName(uint32(i), shfStrings, true);
-}
+func (i SectionFlag) String() string { return flagName(uint32(i), shfStrings, false) }
+func (i SectionFlag) GoString() string { return flagName(uint32(i), shfStrings, true) }
// Prog.Type
type ProgType int
@@ -487,12 +451,8 @@ var ptStrings = []intName{
intName{0x7fffffff, "PT_HIPROC"},
}
-func (i ProgType) String() string {
- return stringName(uint32(i), ptStrings, false);
-}
-func (i ProgType) GoString() string {
- return stringName(uint32(i), ptStrings, true);
-}
+func (i ProgType) String() string { return stringName(uint32(i), ptStrings, false) }
+func (i ProgType) GoString() string { return stringName(uint32(i), ptStrings, true) }
// Prog.Flag
type ProgFlag uint32
@@ -511,12 +471,8 @@ var pfStrings = []intName{
intName{0x4, "PF_R"},
}
-func (i ProgFlag) String() string {
- return flagName(uint32(i), pfStrings, false);
-}
-func (i ProgFlag) GoString() string {
- return flagName(uint32(i), pfStrings, true);
-}
+func (i ProgFlag) String() string { return flagName(uint32(i), pfStrings, false) }
+func (i ProgFlag) GoString() string { return flagName(uint32(i), pfStrings, true) }
// Dyn.Tag
type DynTag int
@@ -607,12 +563,8 @@ var dtStrings = []intName{
intName{0x7fffffff, "DT_HIPROC"},
}
-func (i DynTag) String() string {
- return stringName(uint32(i), dtStrings, false);
-}
-func (i DynTag) GoString() string {
- return stringName(uint32(i), dtStrings, true);
-}
+func (i DynTag) String() string { return stringName(uint32(i), dtStrings, false) }
+func (i DynTag) GoString() string { return stringName(uint32(i), dtStrings, true) }
// DT_FLAGS values.
type DynFlag int
@@ -640,12 +592,8 @@ var dflagStrings = []intName{
intName{0x0010, "DF_STATIC_TLS"},
}
-func (i DynFlag) String() string {
- return flagName(uint32(i), dflagStrings, false);
-}
-func (i DynFlag) GoString() string {
- return flagName(uint32(i), dflagStrings, true);
-}
+func (i DynFlag) String() string { return flagName(uint32(i), dflagStrings, false) }
+func (i DynFlag) GoString() string { return flagName(uint32(i), dflagStrings, true) }
// NType values; used in core files.
type NType int
@@ -662,12 +610,8 @@ var ntypeStrings = []intName{
intName{3, "NT_PRPSINFO"},
}
-func (i NType) String() string {
- return stringName(uint32(i), ntypeStrings, false);
-}
-func (i NType) GoString() string {
- return stringName(uint32(i), ntypeStrings, true);
-}
+func (i NType) String() string { return stringName(uint32(i), ntypeStrings, false) }
+func (i NType) GoString() string { return stringName(uint32(i), ntypeStrings, true) }
/* Symbol Binding - ELFNN_ST_BIND - st_info */
type SymBind int
@@ -692,12 +636,8 @@ var stbStrings = []intName{
intName{15, "STB_HIPROC"},
}
-func (i SymBind) String() string {
- return stringName(uint32(i), stbStrings, false);
-}
-func (i SymBind) GoString() string {
- return stringName(uint32(i), stbStrings, true);
-}
+func (i SymBind) String() string { return stringName(uint32(i), stbStrings, false) }
+func (i SymBind) GoString() string { return stringName(uint32(i), stbStrings, true) }
/* Symbol type - ELFNN_ST_TYPE - st_info */
type SymType int
@@ -730,12 +670,8 @@ var sttStrings = []intName{
intName{15, "STT_HIPROC"},
}
-func (i SymType) String() string {
- return stringName(uint32(i), sttStrings, false);
-}
-func (i SymType) GoString() string {
- return stringName(uint32(i), sttStrings, true);
-}
+func (i SymType) String() string { return stringName(uint32(i), sttStrings, false) }
+func (i SymType) GoString() string { return stringName(uint32(i), sttStrings, true) }
/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */
type SymVis int
@@ -754,12 +690,8 @@ var stvStrings = []intName{
intName{0x3, "STV_PROTECTED"},
}
-func (i SymVis) String() string {
- return stringName(uint32(i), stvStrings, false);
-}
-func (i SymVis) GoString() string {
- return stringName(uint32(i), stvStrings, true);
-}
+func (i SymVis) String() string { return stringName(uint32(i), stvStrings, false) }
+func (i SymVis) GoString() string { return stringName(uint32(i), stvStrings, true) }
/*
* Relocation types.
@@ -822,12 +754,8 @@ var rx86_64Strings = []intName{
intName{23, "R_X86_64_TPOFF32"},
}
-func (i R_X86_64) String() string {
- return stringName(uint32(i), rx86_64Strings, false);
-}
-func (i R_X86_64) GoString() string {
- return stringName(uint32(i), rx86_64Strings, true);
-}
+func (i R_X86_64) String() string { return stringName(uint32(i), rx86_64Strings, false) }
+func (i R_X86_64) GoString() string { return stringName(uint32(i), rx86_64Strings, true) }
// Relocation types for Alpha.
type R_ALPHA int
@@ -894,12 +822,8 @@ var ralphaStrings = []intName{
intName{27, "R_ALPHA_RELATIVE"},
}
-func (i R_ALPHA) String() string {
- return stringName(uint32(i), ralphaStrings, false);
-}
-func (i R_ALPHA) GoString() string {
- return stringName(uint32(i), ralphaStrings, true);
-}
+func (i R_ALPHA) String() string { return stringName(uint32(i), ralphaStrings, false) }
+func (i R_ALPHA) GoString() string { return stringName(uint32(i), ralphaStrings, true) }
// Relocation types for ARM.
type R_ARM int
@@ -976,12 +900,8 @@ var rarmStrings = []intName{
intName{255, "R_ARM_RBASE"},
}
-func (i R_ARM) String() string {
- return stringName(uint32(i), rarmStrings, false);
-}
-func (i R_ARM) GoString() string {
- return stringName(uint32(i), rarmStrings, true);
-}
+func (i R_ARM) String() string { return stringName(uint32(i), rarmStrings, false) }
+func (i R_ARM) GoString() string { return stringName(uint32(i), rarmStrings, true) }
// Relocation types for 386.
type R_386 int
@@ -1054,12 +974,8 @@ var r386Strings = []intName{
intName{37, "R_386_TLS_TPOFF32"},
}
-func (i R_386) String() string {
- return stringName(uint32(i), r386Strings, false);
-}
-func (i R_386) GoString() string {
- return stringName(uint32(i), r386Strings, true);
-}
+func (i R_386) String() string { return stringName(uint32(i), r386Strings, false) }
+func (i R_386) GoString() string { return stringName(uint32(i), r386Strings, true) }
// Relocation types for PowerPC.
type R_PPC int
@@ -1226,12 +1142,8 @@ var rppcStrings = []intName{
intName{116, "R_PPC_EMB_RELSDA"},
}
-func (i R_PPC) String() string {
- return stringName(uint32(i), rppcStrings, false);
-}
-func (i R_PPC) GoString() string {
- return stringName(uint32(i), rppcStrings, true);
-}
+func (i R_PPC) String() string { return stringName(uint32(i), rppcStrings, false) }
+func (i R_PPC) GoString() string { return stringName(uint32(i), rppcStrings, true) }
// Relocation types for SPARC.
type R_SPARC int
@@ -1354,12 +1266,8 @@ var rsparcStrings = []intName{
intName{55, "R_SPARC_UA16"},
}
-func (i R_SPARC) String() string {
- return stringName(uint32(i), rsparcStrings, false);
-}
-func (i R_SPARC) GoString() string {
- return stringName(uint32(i), rsparcStrings, true);
-}
+func (i R_SPARC) String() string { return stringName(uint32(i), rsparcStrings, false) }
+func (i R_SPARC) GoString() string { return stringName(uint32(i), rsparcStrings, true) }
/*
* Magic number for the elf trampoline, chosen wisely to be an immediate
@@ -1443,15 +1351,9 @@ type Rela32 struct {
Addend int32; /* Addend. */
}
-func R_SYM32(info uint32) uint32 {
- return uint32(info>>8);
-}
-func R_TYPE32(info uint32) uint32 {
- return uint32(info&0xff);
-}
-func R_INFO32(sym, typ uint32) uint32 {
- return sym<<8 | typ;
-}
+func R_SYM32(info uint32) uint32 { return uint32(info>>8) }
+func R_TYPE32(info uint32) uint32 { return uint32(info&0xff) }
+func R_INFO32(sym, typ uint32) uint32 { return sym<<8 | typ }
// ELF32 Symbol.
type Sym32 struct {
@@ -1465,15 +1367,9 @@ type Sym32 struct {
const Sym32Size = 16
-func ST_BIND(info uint8) SymBind {
- return SymBind(info>>4);
-}
-func ST_TYPE(bind SymBind, typ SymType) uint8 {
- return uint8(bind)<<4 | uint8(typ)&0xf;
-}
-func ST_VISIBILITY(other uint8) SymVis {
- return SymVis(other&3);
-}
+func ST_BIND(info uint8) SymBind { return SymBind(info>>4) }
+func ST_TYPE(bind SymBind, typ SymType) uint8 { return uint8(bind)<<4 | uint8(typ)&0xf }
+func ST_VISIBILITY(other uint8) SymVis { return SymVis(other&3) }
/*
* ELF64
@@ -1558,15 +1454,9 @@ type Rela64 struct {
Addend int64; /* Addend. */
}
-func R_SYM64(info uint64) uint32 {
- return uint32(info>>32);
-}
-func R_TYPE64(info uint64) uint32 {
- return uint32(info);
-}
-func R_INFO(sym, typ uint32) uint64 {
- return uint64(sym)<<32 | uint64(typ);
-}
+func R_SYM64(info uint64) uint32 { return uint32(info>>32) }
+func R_TYPE64(info uint64) uint32 { return uint32(info) }
+func R_INFO(sym, typ uint32) uint64 { return uint64(sym)<<32 | uint64(typ) }
/*
diff --git a/src/pkg/debug/elf/file.go b/src/pkg/debug/elf/file.go
index 0945eb506..c51f9bd16 100644
--- a/src/pkg/debug/elf/file.go
+++ b/src/pkg/debug/elf/file.go
@@ -76,9 +76,7 @@ func (s *Section) Data() ([]byte, os.Error) {
}
// Open returns a new ReadSeeker reading the ELF section.
-func (s *Section) Open() io.ReadSeeker {
- return io.NewSectionReader(s.sr, 0, 1<<63 - 1);
-}
+func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63 - 1) }
// A ProgHeader represents a single ELF program header.
type ProgHeader struct {
@@ -106,9 +104,7 @@ type Prog struct {
}
// Open returns a new ReadSeeker reading the ELF program body.
-func (p *Prog) Open() io.ReadSeeker {
- return io.NewSectionReader(p.sr, 0, 1<<63 - 1);
-}
+func (p *Prog) Open() io.ReadSeeker { return io.NewSectionReader(p.sr, 0, 1<<63 - 1) }
// A Symbol represents an entry in an ELF symbol table section.
type Symbol struct {
diff --git a/src/pkg/debug/gosym/symtab.go b/src/pkg/debug/gosym/symtab.go
index 153465ae4..cb9b1f4eb 100644
--- a/src/pkg/debug/gosym/symtab.go
+++ b/src/pkg/debug/gosym/symtab.go
@@ -35,9 +35,7 @@ type Sym struct {
}
// Static returns whether this symbol is static (not visible outside its file).
-func (s *Sym) Static() bool {
- return s.Type >= 'a';
-}
+func (s *Sym) Static() bool { return s.Type >= 'a' }
// PackageName returns the package part of the symbol name,
// or the empty string if there is none.
@@ -518,9 +516,7 @@ func (o *Obj) alineFromLine(path string, line int) (int, os.Error) {
// the symbol table.
type UnknownFileError string
-func (e UnknownFileError) String() string {
- return "unknown file: " + string(e);
-}
+func (e UnknownFileError) String() string { return "unknown file: " + string(e) }
// UnknownLineError represents a failure to map a line to a program
// counter, either because the line is beyond the bounds of the file
diff --git a/src/pkg/debug/macho/file.go b/src/pkg/debug/macho/file.go
index 3561e03fd..52ba94fd7 100644
--- a/src/pkg/debug/macho/file.go
+++ b/src/pkg/debug/macho/file.go
@@ -35,9 +35,7 @@ type Load interface {
// A LoadBytes is the uninterpreted bytes of a Mach-O load command.
type LoadBytes []byte
-func (b LoadBytes) Raw() []byte {
- return b;
-}
+func (b LoadBytes) Raw() []byte { return b }
// A SegmentHeader is the header for a Mach-O 32-bit or 64-bit load segment command.
type SegmentHeader struct {
@@ -77,9 +75,7 @@ func (s *Segment) Data() ([]byte, os.Error) {
}
// Open returns a new ReadSeeker reading the segment.
-func (s *Segment) Open() io.ReadSeeker {
- return io.NewSectionReader(s.sr, 0, 1<<63 - 1);
-}
+func (s *Segment) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63 - 1) }
type SectionHeader struct {
Name string;
@@ -114,9 +110,7 @@ func (s *Section) Data() ([]byte, os.Error) {
}
// Open returns a new ReadSeeker reading the Mach-O section.
-func (s *Section) Open() io.ReadSeeker {
- return io.NewSectionReader(s.sr, 0, 1<<63 - 1);
-}
+func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63 - 1) }
/*
diff --git a/src/pkg/debug/macho/macho.go b/src/pkg/debug/macho/macho.go
index 4903f1345..d8fbba376 100644
--- a/src/pkg/debug/macho/macho.go
+++ b/src/pkg/debug/macho/macho.go
@@ -51,12 +51,8 @@ var cpuStrings = []intName{
intName{uint32(CpuAmd64), "CpuAmd64"},
}
-func (i Cpu) String() string {
- return stringName(uint32(i), cpuStrings, false);
-}
-func (i Cpu) GoString() string {
- return stringName(uint32(i), cpuStrings, true);
-}
+func (i Cpu) String() string { return stringName(uint32(i), cpuStrings, false) }
+func (i Cpu) GoString() string { return stringName(uint32(i), cpuStrings, true) }
// A LoadCmd is a Mach-O load command.
type LoadCmd uint32
@@ -75,12 +71,8 @@ var cmdStrings = []intName{
intName{uint32(LoadCmdUnixThread), "LoadCmdUnixThread"},
}
-func (i LoadCmd) String() string {
- return stringName(uint32(i), cmdStrings, false);
-}
-func (i LoadCmd) GoString() string {
- return stringName(uint32(i), cmdStrings, true);
-}
+func (i LoadCmd) String() string { return stringName(uint32(i), cmdStrings, false) }
+func (i LoadCmd) GoString() string { return stringName(uint32(i), cmdStrings, true) }
// A Segment64 is a 64-bit Mach-O segment load command.
type Segment64 struct {
diff --git a/src/pkg/debug/proc/proc.go b/src/pkg/debug/proc/proc.go
index 084228b24..0719ebef3 100644
--- a/src/pkg/debug/proc/proc.go
+++ b/src/pkg/debug/proc/proc.go
@@ -151,18 +151,14 @@ type Process interface {
// stop.
type Stopped struct{}
-func (c Stopped) String() string {
- return "stopped";
-}
+func (c Stopped) String() string { return "stopped" }
// Breakpoint is a stop cause resulting from a thread reaching a set
// breakpoint.
type Breakpoint Word
// PC returns the program counter that the program is stopped at.
-func (c Breakpoint) PC() Word {
- return Word(c);
-}
+func (c Breakpoint) PC() Word { return Word(c) }
func (c Breakpoint) String() string {
return "breakpoint at 0x" + strconv.Uitob64(uint64(c.PC()), 16);
@@ -173,13 +169,9 @@ func (c Breakpoint) String() string {
type Signal string
// Signal returns the signal being delivered to the thread.
-func (c Signal) Name() string {
- return string(c);
-}
+func (c Signal) Name() string { return string(c) }
-func (c Signal) String() string {
- return c.Name();
-}
+func (c Signal) String() string { return c.Name() }
// ThreadCreate is a stop cause returned from an existing thread when
// it creates a new thread. The new thread exists in a primordial
@@ -189,13 +181,9 @@ type ThreadCreate struct {
thread Thread;
}
-func (c *ThreadCreate) NewThread() Thread {
- return c.thread;
-}
+func (c *ThreadCreate) NewThread() Thread { return c.thread }
-func (c *ThreadCreate) String() string {
- return "thread create";
-}
+func (c *ThreadCreate) String() string { return "thread create" }
// ThreadExit is a stop cause resulting from a thread exiting. When
// this cause first arises, the thread will still be in the list of
@@ -207,26 +195,18 @@ type ThreadExit struct {
}
// Exited returns true if the thread exited normally.
-func (c *ThreadExit) Exited() bool {
- return c.exitStatus != -1;
-}
+func (c *ThreadExit) Exited() bool { return c.exitStatus != -1 }
// ExitStatus returns the exit status of the thread if it exited
// normally or -1 otherwise.
-func (c *ThreadExit) ExitStatus() int {
- return c.exitStatus;
-}
+func (c *ThreadExit) ExitStatus() int { return c.exitStatus }
// Signaled returns true if the thread was terminated by a signal.
-func (c *ThreadExit) Signaled() bool {
- return c.exitStatus == -1;
-}
+func (c *ThreadExit) Signaled() bool { return c.exitStatus == -1 }
// StopSignal returns the signal that terminated the thread, or "" if
// it was not terminated by a signal.
-func (c *ThreadExit) StopSignal() string {
- return c.signal;
-}
+func (c *ThreadExit) StopSignal() string { return c.signal }
func (c *ThreadExit) String() string {
res := "thread exited ";
diff --git a/src/pkg/debug/proc/proc_linux.go b/src/pkg/debug/proc/proc_linux.go
index 60a0555e9..ac469ecad 100644
--- a/src/pkg/debug/proc/proc_linux.go
+++ b/src/pkg/debug/proc/proc_linux.go
@@ -84,17 +84,11 @@ func (ts threadState) isStopped() bool {
return ts == stopped || ts == stoppedBreakpoint || ts == stoppedSignal || ts == stoppedThreadCreate || ts == stoppedExiting;
}
-func (ts threadState) isZombie() bool {
- return ts == exiting;
-}
+func (ts threadState) isZombie() bool { return ts == exiting }
-func (ts threadState) isTerminal() bool {
- return ts == exited || ts == detached;
-}
+func (ts threadState) isTerminal() bool { return ts == exited || ts == detached }
-func (ts threadState) String() string {
- return string(ts);
-}
+func (ts threadState) String() string { return string(ts) }
/*
* Basic types
@@ -206,9 +200,7 @@ func (e breakpointExistsError) String() string {
type noBreakpointError Word
-func (e noBreakpointError) String() string {
- return fmt.Sprintf("no breakpoint at PC %#x", e);
-}
+func (e noBreakpointError) String() string { return fmt.Sprintf("no breakpoint at PC %#x", e) }
type newThreadError struct {
*os.Waitmsg;
@@ -222,9 +214,7 @@ func (e *newThreadError) String() string {
type ProcessExited struct{}
-func (p ProcessExited) String() string {
- return "process exited";
-}
+func (p ProcessExited) String() string { return "process exited" }
/*
* Ptrace wrappers
diff --git a/src/pkg/debug/proc/regs_linux_386.go b/src/pkg/debug/proc/regs_linux_386.go
index 496fbc337..a665cd4d1 100644
--- a/src/pkg/debug/proc/regs_linux_386.go
+++ b/src/pkg/debug/proc/regs_linux_386.go
@@ -34,9 +34,7 @@ var names = [...]string{
"gs",
}
-func (r *_386Regs) PC() Word {
- return Word(r.Eip);
-}
+func (r *_386Regs) PC() Word { return Word(r.Eip) }
func (r *_386Regs) SetPC(val Word) os.Error {
r.Eip = int32(val);
@@ -48,22 +46,16 @@ func (r *_386Regs) Link() Word {
panic("No link register");
}
-func (r *_386Regs) SetLink(val Word) os.Error {
- panic("No link register");
-}
+func (r *_386Regs) SetLink(val Word) os.Error { panic("No link register") }
-func (r *_386Regs) SP() Word {
- return Word(r.Esp);
-}
+func (r *_386Regs) SP() Word { return Word(r.Esp) }
func (r *_386Regs) SetSP(val Word) os.Error {
r.Esp = int32(val);
return r.setter(&r.PtraceRegs);
}
-func (r *_386Regs) Names() []string {
- return &names;
-}
+func (r *_386Regs) Names() []string { return &names }
func (r *_386Regs) Get(i int) Word {
switch i {
diff --git a/src/pkg/debug/proc/regs_linux_amd64.go b/src/pkg/debug/proc/regs_linux_amd64.go
index 068add85d..64559dc9e 100644
--- a/src/pkg/debug/proc/regs_linux_amd64.go
+++ b/src/pkg/debug/proc/regs_linux_amd64.go
@@ -48,9 +48,7 @@ var names = [...]string{
//"gs_base",
}
-func (r *amd64Regs) PC() Word {
- return Word(r.Rip);
-}
+func (r *amd64Regs) PC() Word { return Word(r.Rip) }
func (r *amd64Regs) SetPC(val Word) os.Error {
r.Rip = uint64(val);
@@ -66,18 +64,14 @@ func (r *amd64Regs) SetLink(val Word) os.Error {
panic("No link register");
}
-func (r *amd64Regs) SP() Word {
- return Word(r.Rsp);
-}
+func (r *amd64Regs) SP() Word { return Word(r.Rsp) }
func (r *amd64Regs) SetSP(val Word) os.Error {
r.Rsp = uint64(val);
return r.setter(&r.PtraceRegs);
}
-func (r *amd64Regs) Names() []string {
- return &names;
-}
+func (r *amd64Regs) Names() []string { return &names }
func (r *amd64Regs) Get(i int) Word {
switch i {
diff --git a/src/pkg/debug/proc/regs_linux_arm.go b/src/pkg/debug/proc/regs_linux_arm.go
index ac4bfb4f0..ed2834f69 100644
--- a/src/pkg/debug/proc/regs_linux_arm.go
+++ b/src/pkg/debug/proc/regs_linux_arm.go
@@ -13,37 +13,21 @@ import (
type armRegs struct{}
-func (r *armRegs) PC() Word {
- return Word(0);
-}
+func (r *armRegs) PC() Word { return Word(0) }
-func (r *armRegs) SetPC(val Word) os.Error {
- return nil;
-}
+func (r *armRegs) SetPC(val Word) os.Error { return nil }
-func (r *armRegs) Link() Word {
- return Word(0);
-}
+func (r *armRegs) Link() Word { return Word(0) }
-func (r *armRegs) SetLink(val Word) os.Error {
- return nil;
-}
+func (r *armRegs) SetLink(val Word) os.Error { return nil }
-func (r *armRegs) SP() Word {
- return Word(0);
-}
+func (r *armRegs) SP() Word { return Word(0) }
-func (r *armRegs) SetSP(val Word) os.Error {
- return nil;
-}
+func (r *armRegs) SetSP(val Word) os.Error { return nil }
-func (r *armRegs) Names() []string {
- return nil;
-}
+func (r *armRegs) Names() []string { return nil }
-func (r *armRegs) Get(i int) Word {
- return Word(0);
-}
+func (r *armRegs) Get(i int) Word { return Word(0) }
func (r *armRegs) Set(i int, val Word) os.Error {
return nil;