mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 03:41:41 +02:00
FpDebug: fix setting negative value to Register for 32bit target.
This commit is contained in:
parent
00fca7c4fa
commit
1d0daee376
@ -858,11 +858,12 @@ procedure TDbgLinuxThread.SetRegisterValue(AName: string; AValue: QWord);
|
||||
begin
|
||||
if Process.Mode=dm32 then
|
||||
begin
|
||||
assert((AValue and QWord($ffffffff00000000) = 0) or (AValue and QWord($ffffffff00000000) = QWord($ffffffff00000000)), 'TDbgLinuxThread.SetRegisterValue: (AValue and QWord($ffffffff00000000) = 0) or (AValue and QWord($ffffffff00000000) = QWord($ffffffff00000000))');
|
||||
case AName of
|
||||
'eip': FUserRegs.regs32[eip] := AValue;
|
||||
'eax': FUserRegs.regs32[eax] := AValue;
|
||||
'ecx': FUserRegs.regs32[ecx] := AValue;
|
||||
'edx': FUserRegs.regs32[edx] := AValue;
|
||||
'eip': FUserRegs.regs32[eip] := cuint32(AValue);
|
||||
'eax': FUserRegs.regs32[eax] := cuint32(AValue);
|
||||
'ecx': FUserRegs.regs32[ecx] := cuint32(AValue);
|
||||
'edx': FUserRegs.regs32[edx] := cuint32(AValue);
|
||||
else
|
||||
raise Exception.CreateFmt('Setting the [%s] register is not supported', [AName]);
|
||||
end;
|
||||
|
@ -1849,21 +1849,23 @@ begin
|
||||
exit;
|
||||
|
||||
{$ifdef cpui386}
|
||||
assert((AValue and QWord($ffffffff00000000) = 0) or (AValue and QWord($ffffffff00000000) = QWord($ffffffff00000000)), 'TDbgWinThread.SetRegisterValue: ((AValue and QWord($ffffffff00000000) = 0) or ((AValue and QWord($ffffffff00000000) = QWord($ffffffff00000000)');
|
||||
case AName of
|
||||
'eip': FCurrentContext^.def.Eip := AValue;
|
||||
'eax': FCurrentContext^.def.Eax := AValue;
|
||||
'ecx': FCurrentContext^.def.Ecx := AValue;
|
||||
'edx': FCurrentContext^.def.Edx := AValue;
|
||||
'eip': FCurrentContext^.def.Eip := DWORD(AValue);
|
||||
'eax': FCurrentContext^.def.Eax := DWORD(AValue);
|
||||
'ecx': FCurrentContext^.def.Ecx := DWORD(AValue);
|
||||
'edx': FCurrentContext^.def.Edx := DWORD(AValue);
|
||||
else
|
||||
raise Exception.CreateFmt('Setting the [%s] register is not supported', [AName]);
|
||||
end;
|
||||
{$else}
|
||||
if (TDbgWinProcess(Process).FBitness = b32) then begin
|
||||
assert((AValue and QWord($ffffffff00000000) = 0) or (AValue and QWord($ffffffff00000000) = QWord($ffffffff00000000)), 'TDbgWinThread.SetRegisterValue: ((AValue and QWord($ffffffff00000000) = 0) or ((AValue and QWord($ffffffff00000000) = QWord($ffffffff00000000)');
|
||||
case AName of
|
||||
'eip': FCurrentContext^.WOW.Eip := AValue;
|
||||
'eax': FCurrentContext^.WOW.Eax := AValue;
|
||||
'ecx': FCurrentContext^.WOW.Ecx := AValue;
|
||||
'edx': FCurrentContext^.WOW.Edx := AValue;
|
||||
'eip': FCurrentContext^.WOW.Eip := DWORD(AValue);
|
||||
'eax': FCurrentContext^.WOW.Eax := DWORD(AValue);
|
||||
'ecx': FCurrentContext^.WOW.Ecx := DWORD(AValue);
|
||||
'edx': FCurrentContext^.WOW.Edx := DWORD(AValue);
|
||||
else
|
||||
raise Exception.CreateFmt('Setting the [%s] register is not supported', [AName]);
|
||||
end;
|
||||
|
@ -1705,6 +1705,14 @@ begin
|
||||
|
||||
move(ASource^, TmpVal, Min(SizeOf(TmpVal), Int64(ASourceSize))); // Little Endian only
|
||||
|
||||
if (DestWriteSize < 8) and
|
||||
(TmpVal and (QWord($ffffffffffffffff) << (DestWriteSize*8)) <> 0) and
|
||||
( (AReadDataType <> rdtSignedInt) or
|
||||
(TmpVal and (QWord($ffffffffffffffff) << (DestWriteSize*8)) <> (QWord($ffffffffffffffff) << (DestWriteSize*8)) )
|
||||
)
|
||||
then
|
||||
exit; // failed
|
||||
|
||||
if not FMemReader.WriteRegister(Cardinal(ADestLocation.Address), TmpVal, AContext) then
|
||||
exit; // failed
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user