mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 20:53:42 +08:00
proc,dwarf/godwarf: support parametric types with dictionaries
Change debug_info type reader and proc to convert parametric types into their real types by reading the corresponding dictionary entry and using the same method used for interfaces to retrieve the DIE from a runtime._type address. '2586e9b1'.
This commit is contained in:
committed by
Alessandro Arzilli
parent
4e7b689e1a
commit
18f2a4c46b
@ -1602,7 +1602,48 @@ func TestCgoEval(t *testing.T) {
|
||||
t.Fatalf("Unexpected error. Expected %s got %s", tc.err.Error(), err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestEvalExpressionGenerics(t *testing.T) {
|
||||
if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) {
|
||||
t.Skip("generics not supported")
|
||||
}
|
||||
|
||||
testcases := [][]varTest{
|
||||
// testfn[int, float32]
|
||||
[]varTest{
|
||||
{"arg1", true, "3", "", "int", nil},
|
||||
{"arg2", true, "2.1", "", "float32", nil},
|
||||
{"m", true, "map[float32]int [2.1: 3, ]", "", "map[float32]int", nil},
|
||||
},
|
||||
|
||||
// testfn[*astruct, astruct]
|
||||
[]varTest{
|
||||
{"arg1", true, "*main.astruct {x: 0, y: 1}", "", "*main.astruct", nil},
|
||||
{"arg2", true, "main.astruct {x: 2, y: 3}", "", "main.astruct", nil},
|
||||
{"m", true, "map[main.astruct]*main.astruct [{x: 2, y: 3}: *{x: 0, y: 1}, ]", "", "map[main.astruct]*main.astruct", nil},
|
||||
},
|
||||
}
|
||||
|
||||
withTestProcess("testvariables_generic", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||
for i, tcs := range testcases {
|
||||
assertNoError(p.Continue(), t, fmt.Sprintf("Continue() returned an error (%d)", i))
|
||||
for _, tc := range tcs {
|
||||
variable, err := evalVariable(p, tc.name, pnormalLoadConfig)
|
||||
if tc.err == nil {
|
||||
assertNoError(err, t, fmt.Sprintf("EvalExpression(%s) returned an error", tc.name))
|
||||
assertVariable(t, variable, tc)
|
||||
} else {
|
||||
if err == nil {
|
||||
t.Fatalf("Expected error %s, got no error (%s)", tc.err.Error(), tc.name)
|
||||
}
|
||||
if tc.err.Error() != err.Error() {
|
||||
t.Fatalf("Unexpected error. Expected %s got %s", tc.err.Error(), err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user