diff --git a/_fixtures/testvariables.go b/_fixtures/testvariables.go index 54533217b74f8c0a93eeb617a121f741dc165da5..7ca4f8adeeca42c063abf2e1d662b8c8b87e1f35 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 87cf15fa745b05e685e59fdb6811b36142d3297a..04eb4509354c51f7a91aafd7a87fd11d355c18a8 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 51ab3c768660a2aa8e72ff1e8e763406f83e8b93..a53461a32ee568aa0a2cd55d9cee6f3c454a1343 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) {