
* Extend the "frame" command to set the current frame. Command frame 3 sets up so that subsequent "print", "set", "whatis" command will operate on frame 3. frame 3 print foo continues to work. Added "up", "down". They move the current frame up or down. Implementation note: This changes removes "scopePrefix" mode from the terminal/command.go and instead have the command examine the goroutine/frame value to see if it is invoked in a scoped context. * Rename Command.Frame -> Command.frame.
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package proc_test
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/derekparker/delve/pkg/proc"
|
|
protest "github.com/derekparker/delve/pkg/proc/test"
|
|
)
|
|
|
|
func TestGoroutineCreationLocation(t *testing.T) {
|
|
protest.AllowRecording(t)
|
|
withTestProcess("goroutinestackprog", t, func(p proc.Process, fixture protest.Fixture) {
|
|
bp, err := setFunctionBreakpoint(p, "main.agoroutine")
|
|
assertNoError(err, t, "BreakByLocation()")
|
|
assertNoError(proc.Continue(p), t, "Continue()")
|
|
|
|
gs, err := proc.GoroutinesInfo(p)
|
|
assertNoError(err, t, "GoroutinesInfo")
|
|
|
|
for _, g := range gs {
|
|
currentLocation := g.UserCurrent()
|
|
currentFn := currentLocation.Fn
|
|
if currentFn != nil && currentFn.BaseName() == "agoroutine" {
|
|
createdLocation := g.Go()
|
|
if createdLocation.Fn == nil {
|
|
t.Fatalf("goroutine creation function is nil")
|
|
}
|
|
if createdLocation.Fn.BaseName() != "main" {
|
|
t.Fatalf("goroutine creation function has wrong name: %s", createdLocation.Fn.BaseName())
|
|
}
|
|
if filepath.Base(createdLocation.File) != "goroutinestackprog.go" {
|
|
t.Fatalf("goroutine creation file incorrect: %s", filepath.Base(createdLocation.File))
|
|
}
|
|
if createdLocation.Line != 23 {
|
|
t.Fatalf("goroutine creation line incorrect: %v", createdLocation.Line)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
p.ClearBreakpoint(bp.Addr)
|
|
proc.Continue(p)
|
|
})
|
|
}
|