diff options
Diffstat (limited to 'src/pkg/debug/proc')
-rw-r--r-- | src/pkg/debug/proc/Makefile | 2 | ||||
-rw-r--r-- | src/pkg/debug/proc/proc_linux.go | 29 | ||||
-rw-r--r-- | src/pkg/debug/proc/proc_nacl.go | 20 | ||||
-rw-r--r-- | src/pkg/debug/proc/regs_linux_386.go | 24 | ||||
-rw-r--r-- | src/pkg/debug/proc/regs_linux_amd64.go | 2 | ||||
-rw-r--r-- | src/pkg/debug/proc/regs_nacl_386.go | 5 |
6 files changed, 28 insertions, 54 deletions
diff --git a/src/pkg/debug/proc/Makefile b/src/pkg/debug/proc/Makefile index 5444ec0db..c6d879836 100644 --- a/src/pkg/debug/proc/Makefile +++ b/src/pkg/debug/proc/Makefile @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -include ../../../Make.$(GOARCH) +include ../../../Make.inc TARG=debug/proc GOFILES=\ diff --git a/src/pkg/debug/proc/proc_linux.go b/src/pkg/debug/proc/proc_linux.go index 5253ea846..f0cc43a10 100644 --- a/src/pkg/debug/proc/proc_linux.go +++ b/src/pkg/debug/proc/proc_linux.go @@ -153,7 +153,7 @@ type process struct { debugEvents chan *debugEvent debugReqs chan *debugReq stopReq chan os.Error - transitionHandlers *vector.Vector + transitionHandlers vector.Vector err os.Error } @@ -297,7 +297,7 @@ func (t *thread) logTrace(format string, args ...interface{}) { } } fmt.Fprint(os.Stderr, ": ") - fmt.Fprintf(os.Stderr, format, args) + fmt.Fprintf(os.Stderr, format, args...) fmt.Fprint(os.Stderr, "\n") } @@ -305,7 +305,7 @@ func (t *thread) warn(format string, args ...interface{}) { logLock.Lock() defer logLock.Unlock() fmt.Fprintf(os.Stderr, "Thread %d: WARNING ", t.tid) - fmt.Fprintf(os.Stderr, format, args) + fmt.Fprintf(os.Stderr, format, args...) fmt.Fprint(os.Stderr, "\n") } @@ -316,7 +316,7 @@ func (p *process) logTrace(format string, args ...interface{}) { logLock.Lock() defer logLock.Unlock() fmt.Fprintf(os.Stderr, "Process %d: ", p.pid) - fmt.Fprintf(os.Stderr, format, args) + fmt.Fprintf(os.Stderr, format, args...) fmt.Fprint(os.Stderr, "\n") } @@ -472,8 +472,8 @@ func (t *thread) setState(newState threadState) { return } - t.proc.transitionHandlers = new(vector.Vector) - for _, h := range handlers.Data() { + t.proc.transitionHandlers = nil + for _, h := range handlers { h := h.(*transitionHandler) h.handle(t, oldState, newState) } @@ -738,7 +738,7 @@ func (p *process) monitor() { // Abort waiting handlers // TODO(austin) How do I stop the wait threads? - for _, h := range p.transitionHandlers.Data() { + for _, h := range p.transitionHandlers { h := h.(*transitionHandler) h.onErr(err) } @@ -1249,14 +1249,13 @@ func (p *process) attachAllThreads() os.Error { // newProcess creates a new process object and starts its monitor thread. func newProcess(pid int) *process { p := &process{ - pid: pid, - threads: make(map[int]*thread), - breakpoints: make(map[uintptr]*breakpoint), - ready: make(chan bool, 1), - debugEvents: make(chan *debugEvent), - debugReqs: make(chan *debugReq), - stopReq: make(chan os.Error), - transitionHandlers: new(vector.Vector), + pid: pid, + threads: make(map[int]*thread), + breakpoints: make(map[uintptr]*breakpoint), + ready: make(chan bool, 1), + debugEvents: make(chan *debugEvent), + debugReqs: make(chan *debugReq), + stopReq: make(chan os.Error), } go p.monitor() diff --git a/src/pkg/debug/proc/proc_nacl.go b/src/pkg/debug/proc/proc_nacl.go deleted file mode 100644 index be26bbf18..000000000 --- a/src/pkg/debug/proc/proc_nacl.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proc - -import ( - "os" - "syscall" -) - -// Process tracing is not supported on Native Client. - -func Attach(pid int) (Process, os.Error) { - return nil, os.NewSyscallError("ptrace", syscall.ENACL) -} - -func ForkExec(argv0 string, argv []string, envv []string, dir string, fd []*os.File) (Process, os.Error) { - return nil, os.NewSyscallError("fork/exec", syscall.ENACL) -} diff --git a/src/pkg/debug/proc/regs_linux_386.go b/src/pkg/debug/proc/regs_linux_386.go index 7cebfa64a..b4a9769db 100644 --- a/src/pkg/debug/proc/regs_linux_386.go +++ b/src/pkg/debug/proc/regs_linux_386.go @@ -80,17 +80,17 @@ func (r *_386Regs) Get(i int) Word { case 9: return Word(uint32(r.Eflags)) case 10: - return Word(r.Cs) + return Word(r.Xcs) case 11: - return Word(r.Ss) + return Word(r.Xss) case 12: - return Word(r.Ds) + return Word(r.Xds) case 13: - return Word(r.Es) + return Word(r.Xes) case 14: - return Word(r.Fs) + return Word(r.Xfs) case 15: - return Word(r.Gs) + return Word(r.Xgs) } panic("invalid register index " + strconv.Itoa(i)) } @@ -118,17 +118,17 @@ func (r *_386Regs) Set(i int, val Word) os.Error { case 9: r.Eflags = int32(val) case 10: - r.Cs = uint16(val) + r.Xcs = int32(val) case 11: - r.Ss = uint16(val) + r.Xss = int32(val) case 12: - r.Ds = uint16(val) + r.Xds = int32(val) case 13: - r.Es = uint16(val) + r.Xes = int32(val) case 14: - r.Fs = uint16(val) + r.Xfs = int32(val) case 15: - r.Gs = uint16(val) + r.Xgs = int32(val) default: panic("invalid register index " + strconv.Itoa(i)) } diff --git a/src/pkg/debug/proc/regs_linux_amd64.go b/src/pkg/debug/proc/regs_linux_amd64.go index a9f3569d3..381be29b1 100644 --- a/src/pkg/debug/proc/regs_linux_amd64.go +++ b/src/pkg/debug/proc/regs_linux_amd64.go @@ -71,7 +71,7 @@ func (r *amd64Regs) SetSP(val Word) os.Error { return r.setter(&r.PtraceRegs) } -func (r *amd64Regs) Names() []string { return &names } +func (r *amd64Regs) Names() []string { return names[0:] } func (r *amd64Regs) Get(i int) Word { switch i { diff --git a/src/pkg/debug/proc/regs_nacl_386.go b/src/pkg/debug/proc/regs_nacl_386.go deleted file mode 100644 index 60c9ac719..000000000 --- a/src/pkg/debug/proc/regs_nacl_386.go +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proc |