From 099efeeb9dff482a1403b114876caafa6bb43b55 Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Fri, 17 Oct 2014 14:14:55 -0500 Subject: [PATCH] Allow evaluation of function params --- _fixtures/testvariables.go | 8 ++++++-- proctl/proctl_linux_amd64.go | 2 +- proctl/proctl_test.go | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/_fixtures/testvariables.go b/_fixtures/testvariables.go index 54533217..7ca4f8ad 100644 --- a/_fixtures/testvariables.go +++ b/_fixtures/testvariables.go @@ -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") } diff --git a/proctl/proctl_linux_amd64.go b/proctl/proctl_linux_amd64.go index 87cf15fa..04eb4509 100644 --- a/proctl/proctl_linux_amd64.go +++ b/proctl/proctl_linux_amd64.go @@ -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 } diff --git a/proctl/proctl_test.go b/proctl/proctl_test.go index 51ab3c76..a53461a3 100644 --- a/proctl/proctl_test.go +++ b/proctl/proctl_test.go @@ -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) { -- GitLab