Commit 6a4940ee authored by Robert Griesemer's avatar Robert Griesemer

gofmt'ed debug

(excluding debug/gosym/symtab.go which has a small issue)

R=rsc
http://go/go-review/1019001
parent 6f762f54
...@@ -416,7 +416,7 @@ const ( ...@@ -416,7 +416,7 @@ const (
opCall2 = 0x98; /* 2-byte offset of DIE */ opCall2 = 0x98; /* 2-byte offset of DIE */
opCall4 = 0x99; /* 4-byte offset of DIE */ opCall4 = 0x99; /* 4-byte offset of DIE */
opCallRef = 0x9A; /* 4- or 8- byte offset of DIE */ opCallRef = 0x9A; /* 4- or 8- byte offset of DIE */
/* 0xE0-0xFF reserved for user-specific */ /* 0xE0-0xFF reserved for user-specific */
) )
// Basic type encodings -- the value for AttrEncoding in a TagBaseType Entry. // Basic type encodings -- the value for AttrEncoding in a TagBaseType Entry.
......
...@@ -29,14 +29,14 @@ type File struct { ...@@ -29,14 +29,14 @@ type File struct {
// A Load represents any Mach-O load command. // A Load represents any Mach-O load command.
type Load interface { type Load interface {
Raw() []byte Raw() []byte;
} }
// A LoadBytes is the uninterpreted bytes of a Mach-O load command. // A LoadBytes is the uninterpreted bytes of a Mach-O load command.
type LoadBytes []byte type LoadBytes []byte
func (b LoadBytes) Raw() []byte { func (b LoadBytes) Raw() []byte {
return b return b;
} }
// A SegmentHeader is the header for a Mach-O 32-bit or 64-bit load segment command. // A SegmentHeader is the header for a Mach-O 32-bit or 64-bit load segment command.
...@@ -315,7 +315,7 @@ func (f *File) pushSection(sh *Section, r io.ReaderAt) { ...@@ -315,7 +315,7 @@ func (f *File) pushSection(sh *Section, r io.ReaderAt) {
} }
f.Sections = new; f.Sections = new;
} }
f.Sections = f.Sections[0:n+1]; f.Sections = f.Sections[0 : n+1];
f.Sections[n] = sh; f.Sections[n] = sh;
sh.sr = io.NewSectionReader(r, int64(sh.Offset), int64(sh.Size)); sh.sr = io.NewSectionReader(r, int64(sh.Offset), int64(sh.Size));
sh.ReaderAt = sh.sr; sh.ReaderAt = sh.sr;
...@@ -323,7 +323,7 @@ func (f *File) pushSection(sh *Section, r io.ReaderAt) { ...@@ -323,7 +323,7 @@ func (f *File) pushSection(sh *Section, r io.ReaderAt) {
func cstring(b []byte) string { func cstring(b []byte) string {
var i int; var i int;
for i=0; i<len(b) && b[i] != 0; i++ { for i = 0; i < len(b) && b[i] != 0; i++ {
} }
return string(b[0:i]); return string(b[0:i]);
} }
......
...@@ -12,10 +12,10 @@ import ( ...@@ -12,10 +12,10 @@ import (
type amd64Regs struct { type amd64Regs struct {
syscall.PtraceRegs; syscall.PtraceRegs;
setter func (*syscall.PtraceRegs) os.Error; setter func(*syscall.PtraceRegs) os.Error;
} }
var names = [...]string { var names = [...]string{
"rax", "rax",
"rbx", "rbx",
"rcx", "rcx",
...@@ -81,67 +81,115 @@ func (r *amd64Regs) Names() []string { ...@@ -81,67 +81,115 @@ func (r *amd64Regs) Names() []string {
func (r *amd64Regs) Get(i int) Word { func (r *amd64Regs) Get(i int) Word {
switch i { switch i {
case 0: return Word(r.Rax); case 0:
case 1: return Word(r.Rbx); return Word(r.Rax);
case 2: return Word(r.Rcx); case 1:
case 3: return Word(r.Rdx); return Word(r.Rbx);
case 4: return Word(r.Rsi); case 2:
case 5: return Word(r.Rdi); return Word(r.Rcx);
case 6: return Word(r.Rbp); case 3:
case 7: return Word(r.Rsp); return Word(r.Rdx);
case 8: return Word(r.R8); case 4:
case 9: return Word(r.R9); return Word(r.Rsi);
case 10: return Word(r.R10); case 5:
case 11: return Word(r.R11); return Word(r.Rdi);
case 12: return Word(r.R12); case 6:
case 13: return Word(r.R13); return Word(r.Rbp);
case 14: return Word(r.R14); case 7:
case 15: return Word(r.R15); return Word(r.Rsp);
case 16: return Word(r.Rip); case 8:
case 17: return Word(r.Eflags); return Word(r.R8);
case 18: return Word(r.Cs); case 9:
case 19: return Word(r.Ss); return Word(r.R9);
case 20: return Word(r.Ds); case 10:
case 21: return Word(r.Es); return Word(r.R10);
case 22: return Word(r.Fs); case 11:
case 23: return Word(r.Gs); return Word(r.R11);
case 12:
return Word(r.R12);
case 13:
return Word(r.R13);
case 14:
return Word(r.R14);
case 15:
return Word(r.R15);
case 16:
return Word(r.Rip);
case 17:
return Word(r.Eflags);
case 18:
return Word(r.Cs);
case 19:
return Word(r.Ss);
case 20:
return Word(r.Ds);
case 21:
return Word(r.Es);
case 22:
return Word(r.Fs);
case 23:
return Word(r.Gs);
} }
panic("invalid register index ", strconv.Itoa(i)); panic("invalid register index ", strconv.Itoa(i));
} }
func (r *amd64Regs) Set(i int, val Word) os.Error { func (r *amd64Regs) Set(i int, val Word) os.Error {
switch i { switch i {
case 0: r.Rax = uint64(val); case 0:
case 1: r.Rbx = uint64(val); r.Rax = uint64(val);
case 2: r.Rcx = uint64(val); case 1:
case 3: r.Rdx = uint64(val); r.Rbx = uint64(val);
case 4: r.Rsi = uint64(val); case 2:
case 5: r.Rdi = uint64(val); r.Rcx = uint64(val);
case 6: r.Rbp = uint64(val); case 3:
case 7: r.Rsp = uint64(val); r.Rdx = uint64(val);
case 8: r.R8 = uint64(val); case 4:
case 9: r.R9 = uint64(val); r.Rsi = uint64(val);
case 10: r.R10 = uint64(val); case 5:
case 11: r.R11 = uint64(val); r.Rdi = uint64(val);
case 12: r.R12 = uint64(val); case 6:
case 13: r.R13 = uint64(val); r.Rbp = uint64(val);
case 14: r.R14 = uint64(val); case 7:
case 15: r.R15 = uint64(val); r.Rsp = uint64(val);
case 16: r.Rip = uint64(val); case 8:
case 17: r.Eflags = uint64(val); r.R8 = uint64(val);
case 18: r.Cs = uint64(val); case 9:
case 19: r.Ss = uint64(val); r.R9 = uint64(val);
case 20: r.Ds = uint64(val); case 10:
case 21: r.Es = uint64(val); r.R10 = uint64(val);
case 22: r.Fs = uint64(val); case 11:
case 23: r.Gs = uint64(val); r.R11 = uint64(val);
case 12:
r.R12 = uint64(val);
case 13:
r.R13 = uint64(val);
case 14:
r.R14 = uint64(val);
case 15:
r.R15 = uint64(val);
case 16:
r.Rip = uint64(val);
case 17:
r.Eflags = uint64(val);
case 18:
r.Cs = uint64(val);
case 19:
r.Ss = uint64(val);
case 20:
r.Ds = uint64(val);
case 21:
r.Es = uint64(val);
case 22:
r.Fs = uint64(val);
case 23:
r.Gs = uint64(val);
default: default:
panic("invalid register index ", strconv.Itoa(i)); panic("invalid register index ", strconv.Itoa(i));
} }
return r.setter(&r.PtraceRegs); return r.setter(&r.PtraceRegs);
} }
func newRegs(regs *syscall.PtraceRegs, setter func (*syscall.PtraceRegs) os.Error) Regs { func newRegs(regs *syscall.PtraceRegs, setter func(*syscall.PtraceRegs) os.Error) Regs {
res := amd64Regs{}; res := amd64Regs{};
res.PtraceRegs = *regs; res.PtraceRegs = *regs;
res.setter = setter; res.setter = setter;
......
...@@ -11,8 +11,7 @@ import ( ...@@ -11,8 +11,7 @@ import (
// TODO(kaib): add support // TODO(kaib): add support
type armRegs struct { type armRegs struct{}
}
func (r *armRegs) PC() Word { func (r *armRegs) PC() Word {
return Word(0); return Word(0);
...@@ -22,35 +21,35 @@ func (r *armRegs) SetPC(val Word) os.Error { ...@@ -22,35 +21,35 @@ func (r *armRegs) SetPC(val Word) os.Error {
return nil; return nil;
} }
func (r * armRegs) Link() Word { func (r *armRegs) Link() Word {
return Word(0); return Word(0);
} }
func (r* armRegs) SetLink(val Word) (os.Error) { func (r *armRegs) SetLink(val Word) os.Error {
return nil; return nil;
} }
func (r* armRegs) SP() Word { func (r *armRegs) SP() Word {
return Word(0); return Word(0);
} }
func (r* armRegs) SetSP(val Word) os.Error { func (r *armRegs) SetSP(val Word) os.Error {
return nil; return nil;
} }
func (r* armRegs) Names() []string { func (r *armRegs) Names() []string {
return nil; return nil;
} }
func (r* armRegs) Get(i int) Word { func (r *armRegs) Get(i int) Word {
return Word(0); return Word(0);
} }
func (r* armRegs) Set(i int, val Word) os.Error { func (r *armRegs) Set(i int, val Word) os.Error {
return nil; return nil;
} }
func newRegs(regs *syscall.PtraceRegs, setter func (*syscall.PtraceRegs) os.Error) Regs { func newRegs(regs *syscall.PtraceRegs, setter func(*syscall.PtraceRegs) os.Error) Regs {
res := armRegs{}; res := armRegs{};
return &res; return &res;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment