Improve variable evaluation scope

Properly scope variable evaluation to the function the traced process is
currently stopped in.
This commit is contained in:
Derek Parker
2014-11-10 21:26:13 -06:00
parent af0e0286a6
commit dcf9f04d45
3 changed files with 60 additions and 17 deletions

View File

@ -24,7 +24,7 @@ func TestVariableEvaluation(t *testing.T) {
{"a1", "foo", "struct string"},
{"a2", "6", "int"},
{"a3", "7.23", "float64"},
{"a4", "[2]int [1 2]", "[97]int"},
{"a4", "[2]int [1 2]", "[65]int"},
{"a5", "len: 5 cap: 5 [1 2 3 4 5]", "struct []int"},
{"a6", "main.FooBar {Baz: 8, Bur: word}", "main.FooBar"},
{"a7", "*main.FooBar {Baz: 5, Bur: strum}", "*main.FooBar"},
@ -35,7 +35,7 @@ func TestVariableEvaluation(t *testing.T) {
}
helper.WithTestProcess(executablePath, t, func(p *proctl.DebuggedProcess) {
pc, _, _ := p.GoSymTable.LineToPC(fp, 24)
pc, _, _ := p.GoSymTable.LineToPC(fp, 29)
_, err := p.Break(uintptr(pc))
assertNoError(err, t, "Break() returned an error")