delve/pkg/proc/variable_test.go
hengwu0 3f7571ec30 proc: implement stacktrace of arm64 (#1780)
* proc: separate amd64-arch code

separate amd64 code about stacktrace, so we can add arm64 stacktrace code.

* proc: implemente stacktrace of arm64

* delve now can use stack, frame commands on arm64-arch debug.

Co-authored-by: tykcd996 <tang.yuke@zte.com.cn>
Co-authored-by: hengwu0 <wu.heng@zte.com.cn>

* test: remove skip-code of stacktrace on arm64

* add LR DWARF register and remove skip-code for fixed tests

* proc: fix the Continue command after the hardcoded breakpoint on arm64

Arm64 use hardware breakpoint, and it will not set PC to the next instruction like amd64. We should move PC in both runtime.breakpoints and hardcoded breakpoints(probably cgo).

* proc: implement cgo stacktrace on arm64

* proc: combine amd64_stack.go and arm64_stack.go file

* proc: reorganize the stacktrace code

* move SwitchStack function arch-related
* fix Continue command after manual stop on arm64
* add timeout flag to make.go to enable infinite timeouts

Co-authored-by: aarzilli <alessandro.arzilli@gmail.com>
Co-authored-by: hengwu0 <wu.heng@zte.com.cn>

Co-authored-by: tykcd996 <56993522+tykcd996@users.noreply.github.com>
Co-authored-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
2020-01-21 09:11:20 -08:00

45 lines
1.3 KiB
Go

package proc_test
import (
"path/filepath"
"testing"
"github.com/go-delve/delve/pkg/proc"
protest "github.com/go-delve/delve/pkg/proc/test"
)
func TestGoroutineCreationLocation(t *testing.T) {
protest.AllowRecording(t)
withTestProcess("goroutinestackprog", t, func(p proc.Process, fixture protest.Fixture) {
bp := setFunctionBreakpoint(p, t, "main.agoroutine")
assertNoError(proc.Continue(p), t, "Continue()")
gs, _, err := proc.GoroutinesInfo(p, 0, 0)
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)
})
}