mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 09:46:56 +08:00
pkg/proc: merge register data before writing to register (#2699)
Right now, if (*compositeMemory).WriteMemory needs to write a value to a register that's smaller than the full size of the register (say, a uint32 being passed as an argument), then (*AMD64Registers).SetReg can later fail a sanity check that ensures the passed DwarfRegister is a full size register. Fix this by reading the old value of the register and overwriting just the relevant parts with the new register. For the purposes of an argument, it would probably be fine to just pad with zeroes, but merging with the existing value is what gdb does. Fixes #2698
This commit is contained in:
@ -245,7 +245,7 @@ func TestDwarfExprComposite(t *testing.T) {
|
||||
if changeCalls[0] != "3 - 2f00000000000000" {
|
||||
t.Errorf("wrong call to SetReg (Rbx)")
|
||||
}
|
||||
if changeCalls[1] != "2 - 0c00" {
|
||||
if changeCalls[1] != "2 - 0c00000000000000" {
|
||||
t.Errorf("wrong call to SetReg (Rcx)")
|
||||
}
|
||||
if mem.data[0x10] != 13 || mem.data[0x11] != 0x00 {
|
||||
|
||||
Reference in New Issue
Block a user