diff options
Diffstat (limited to 'src/pkg/exp/ogle/goroutine.go')
| -rw-r--r-- | src/pkg/exp/ogle/goroutine.go | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/pkg/exp/ogle/goroutine.go b/src/pkg/exp/ogle/goroutine.go index 0c0075249..5104ec6d4 100644 --- a/src/pkg/exp/ogle/goroutine.go +++ b/src/pkg/exp/ogle/goroutine.go @@ -5,17 +5,17 @@ package ogle import ( - "debug/proc"; - "exp/eval"; - "fmt"; - "os"; + "debug/proc" + "exp/eval" + "fmt" + "os" ) // A Goroutine represents a goroutine in a remote process. type Goroutine struct { - g remoteStruct; - frame *Frame; - dead bool; + g remoteStruct + frame *Frame + dead bool } func (t *Goroutine) String() string { @@ -24,94 +24,94 @@ func (t *Goroutine) String() string { } // TODO(austin) Give threads friendly ID's, possibly including // the name of the entry function. - return fmt.Sprintf("thread %#x", t.g.addr().base); + return fmt.Sprintf("thread %#x", t.g.addr().base) } // isG0 returns true if this thread if the internal idle thread -func (t *Goroutine) isG0() bool { return t.g.addr().base == t.g.r.p.sys.g0.addr().base } +func (t *Goroutine) isG0() bool { return t.g.addr().base == t.g.r.p.sys.g0.addr().base } func (t *Goroutine) resetFrame() (err os.Error) { // TODO(austin) Reuse any live part of the current frame stack // so existing references to Frame's keep working. - t.frame, err = newFrame(t.g); - return; + t.frame, err = newFrame(t.g) + return } // Out selects the caller frame of the current frame. func (t *Goroutine) Out() os.Error { - f, err := t.frame.Outer(); + f, err := t.frame.Outer() if f != nil { t.frame = f } - return err; + return err } // In selects the frame called by the current frame. func (t *Goroutine) In() os.Error { - f := t.frame.Inner(); + f := t.frame.Inner() if f != nil { t.frame = f } - return nil; + return nil } func readylockedBP(ev Event) (EventAction, os.Error) { - b := ev.(*Breakpoint); - p := b.Process(); + b := ev.(*Breakpoint) + p := b.Process() // The new g is the only argument to this function, so the // stack will have the return address, then the G*. - regs, err := b.osThread.Regs(); + regs, err := b.osThread.Regs() if err != nil { return EAStop, err } - sp := regs.SP(); - addr := sp + proc.Word(p.PtrSize()); - arg := remotePtr{remote{addr, p}, p.runtime.G}; - var gp eval.Value; - err = try(func(a aborter) { gp = arg.aGet(a) }); + sp := regs.SP() + addr := sp + proc.Word(p.PtrSize()) + arg := remotePtr{remote{addr, p}, p.runtime.G} + var gp eval.Value + err = try(func(a aborter) { gp = arg.aGet(a) }) if err != nil { return EAStop, err } if gp == nil { return EAStop, UnknownGoroutine{b.osThread, 0} } - gs := gp.(remoteStruct); - g := &Goroutine{gs, nil, false}; - p.goroutines[gs.addr().base] = g; + gs := gp.(remoteStruct) + g := &Goroutine{gs, nil, false} + p.goroutines[gs.addr().base] = g // Enqueue goroutine creation event - parent := b.Goroutine(); + parent := b.Goroutine() if parent.isG0() { parent = nil } - p.postEvent(&GoroutineCreate{commonEvent{p, g}, parent}); + p.postEvent(&GoroutineCreate{commonEvent{p, g}, parent}) // If we don't have any thread selected, select this one if p.curGoroutine == nil { p.curGoroutine = g } - return EADefault, nil; + return EADefault, nil } func goexitBP(ev Event) (EventAction, os.Error) { - b := ev.(*Breakpoint); - p := b.Process(); + b := ev.(*Breakpoint) + p := b.Process() - g := b.Goroutine(); - g.dead = true; + g := b.Goroutine() + g.dead = true - addr := g.g.addr().base; - p.goroutines[addr] = nil, false; + addr := g.g.addr().base + p.goroutines[addr] = nil, false // Enqueue thread exit event - p.postEvent(&GoroutineExit{commonEvent{p, g}}); + p.postEvent(&GoroutineExit{commonEvent{p, g}}) // If we just exited our selected goroutine, selected another if p.curGoroutine == g { p.selectSomeGoroutine() } - return EADefault, nil; + return EADefault, nil } |
