Fixes the ComputePadding calculation to take into account the padding
added for the current offset. This fixes an issue where padding can be
added incorrectly for certain structs.
Related: https://github.com/go-delve/delve/issues/3923
Same as https://go-review.googlesource.com/c/go/+/656736 just without
the brittle test.
Fixes #72053
Change-Id: I67f157a42f5fc5d3a54d0e9be03488aa44752bcb
GitHub-Last-Rev:
fabed69a31258fa8c1806f88d1cbcc745c881148
GitHub-Pull-Request: golang/go#72997
Reviewed-on: https://go-review.googlesource.com/c/go/+/659698
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
panic("internal error")
}
offsets, _ := appendParamOffsets([]int64{}, 0, pa.Type)
- off := int64(0)
for idx, t := range types {
ts := t.Size()
- off += int64(ts)
+ off := offsets[idx] + ts
if idx < len(types)-1 {
noff := offsets[idx+1]
if noff != off {
f.Entry.Values = append(newValues, f.Entry.Values...)
}
-// BuildFuncDebug debug information for f, placing the results
+// BuildFuncDebug builds debug information for f, placing the results
// in "rval". f must be fully processed, so that each Value is where it
// will be when machine code is emitted.
func BuildFuncDebug(ctxt *obj.Link, f *Func, loggingLevel int, stackOffset func(LocalSlot) int32, rval *FuncDebug) {
padding := make([]uint64, 32)
parm := regRes.InParams()[1]
padding = parm.ComputePadding(padding)
- want := "[1 1 1 0]"
+ want := "[1 0 0 0]"
got := fmt.Sprintf("%+v", padding)
if got != want {
- t.Errorf("padding mismatch: wanted %q got %q\n", got, want)
+ t.Errorf("padding mismatch: wanted %q got %q\n", want, got)
}
}