Allow evaluation of function params

This commit is contained in:
Derek Parker 2014-10-17 14:14:55 -05:00
parent 5f0d3a5bb6
commit 099efeeb9d
3 changed files with 8 additions and 3 deletions

@ -7,7 +7,7 @@ type FooBar struct {
Bur string
}
func main() {
func foobar(baz string) {
var (
a1 = "foo"
a2 = 6
@ -18,5 +18,9 @@ func main() {
a7 = &FooBar{Baz: 5, Bur: "strum"}
)
fmt.Println(a1, a2, a3, a4, a5, a6, a7)
fmt.Println(a1, a2, a3, a4, a5, a6, a7, baz)
}
func main() {
foobar("bazburzum")
}

@ -369,7 +369,7 @@ func (dbp *DebuggedProcess) EvalSymbol(name string) (*Variable, error) {
return nil, err
}
if entry.Tag != dwarf.TagVariable {
if entry.Tag != dwarf.TagVariable && entry.Tag != dwarf.TagFormalParameter {
continue
}

@ -233,6 +233,7 @@ func TestVariableEvaluation(t *testing.T) {
{"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"},
{"baz", "bazburzum", "struct string"},
}
helper.WithTestProcess(executablePath, t, func(p *proctl.DebuggedProcess) {