proc: Improvements to Variable printing (#444)

* service/api: Removed unused fields of service/api.Function

* proc/eval: Set return variable name to input expression

* all: fine-grained control of loadValue for better variable printing

Makes proc.(*Variable).loadValue loading parameters configurable
through one extra argument of type LoadConfig.
This interface is also exposed through the API so clients can control
how much of a variable delve should read.
This commit is contained in:
Alessandro Arzilli
2016-04-24 19:15:39 +02:00
committed by Derek Parker
parent 60946a759c
commit 473b66387c
23 changed files with 782 additions and 468 deletions

View File

@ -357,3 +357,44 @@ func TestNoVars(t *testing.T) {
term.AssertExec("vars filterThatMatchesNothing", "(no vars)\n")
})
}
func TestOnPrefixLocals(t *testing.T) {
const prefix = "\ti: "
withTestTerminal("goroutinestackprog", t, func(term *FakeTerminal) {
term.MustExec("b agobp main.agoroutine")
term.MustExec("on agobp args -v")
seen := make([]bool, 10)
for {
outstr, err := term.Exec("continue")
if err != nil {
if strings.Index(err.Error(), "exited") < 0 {
t.Fatalf("Unexpected error executing 'continue': %v", err)
}
break
}
out := strings.Split(outstr, "\n")
for i := range out {
if !strings.HasPrefix(out[i], "\ti: ") {
continue
}
id, err := strconv.Atoi(out[i][len(prefix):])
if err != nil {
continue
}
if seen[id] {
t.Fatalf("Goroutine %d seen twice\n", id)
}
seen[id] = true
}
}
for i := range seen {
if !seen[i] {
t.Fatalf("Goroutine %d not seen\n", i)
}
}
})
}