mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 01:27:16 +08:00
pkg/proc: pad variable mem in extractVarInfoFromEntry (#3365)
* pkg/proc: pad variable mem in extractVarInfoFromEntry
On 64 bit system, the byte size of the following struct is 16:
type myStruct struct {
a int
b uint32
}
But extractVarInfoFromEntry only allocates a mem of 12 bytes for it.
When calling method of this struct with the "call" command, it will
result in this error:
write out of bounds
This patch extends the mem by adding padding bytes to the end of the
mem.
Fixes #3364.
* move the padding logic into newCompositeMemory
This commit is contained in:
@ -1267,6 +1267,7 @@ func TestCallFunction(t *testing.T) {
|
||||
{`regabistacktest("one", "two", "three", "four", "five", 4)`, []string{`:string:"onetwo"`, `:string:"twothree"`, `:string:"threefour"`, `:string:"fourfive"`, `:string:"fiveone"`, ":uint8:8"}, nil},
|
||||
{`regabistacktest2(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)`, []string{":int:3", ":int:5", ":int:7", ":int:9", ":int:11", ":int:13", ":int:15", ":int:17", ":int:19", ":int:11"}, nil},
|
||||
{`issue2698.String()`, []string{`:string:"1 2 3 4"`}, nil},
|
||||
{`issue3364.String()`, []string{`:string:"1 2"`}, nil},
|
||||
{`regabistacktest3(rast3, 5)`, []string{`:[10]string:[10]string ["onetwo","twothree","threefour","fourfive","fivesix","sixseven","sevenheight","heightnine","nineten","tenone"]`, ":uint8:15"}, nil},
|
||||
{`floatsum(1, 2)`, []string{":float64:3"}, nil},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user