提交 099efeeb 编写于 作者: D Derek Parker

Allow evaluation of function params

上级 5f0d3a5b
...@@ -7,7 +7,7 @@ type FooBar struct { ...@@ -7,7 +7,7 @@ type FooBar struct {
Bur string Bur string
} }
func main() { func foobar(baz string) {
var ( var (
a1 = "foo" a1 = "foo"
a2 = 6 a2 = 6
...@@ -18,5 +18,9 @@ func main() { ...@@ -18,5 +18,9 @@ func main() {
a7 = &FooBar{Baz: 5, Bur: "strum"} 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) { ...@@ -369,7 +369,7 @@ func (dbp *DebuggedProcess) EvalSymbol(name string) (*Variable, error) {
return nil, err return nil, err
} }
if entry.Tag != dwarf.TagVariable { if entry.Tag != dwarf.TagVariable && entry.Tag != dwarf.TagFormalParameter {
continue continue
} }
......
...@@ -233,6 +233,7 @@ func TestVariableEvaluation(t *testing.T) { ...@@ -233,6 +233,7 @@ func TestVariableEvaluation(t *testing.T) {
{"a5", "len: 5 cap: 5 [1 2 3 4 5]", "struct []int"}, {"a5", "len: 5 cap: 5 [1 2 3 4 5]", "struct []int"},
{"a6", "main.FooBar {Baz: 8, Bur: word}", "main.FooBar"}, {"a6", "main.FooBar {Baz: 8, Bur: word}", "main.FooBar"},
{"a7", "*main.FooBar {Baz: 5, Bur: strum}", "*main.FooBar"}, {"a7", "*main.FooBar {Baz: 5, Bur: strum}", "*main.FooBar"},
{"baz", "bazburzum", "struct string"},
} }
helper.WithTestProcess(executablePath, t, func(p *proctl.DebuggedProcess) { helper.WithTestProcess(executablePath, t, func(p *proctl.DebuggedProcess) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册