FpDebug: Improve partial mem-read. Check early if the address is readable at all.

This commit is contained in:
Martin 2023-03-02 20:05:17 +01:00
parent faf2fe7a80
commit 8970a4768b
2 changed files with 12 additions and 0 deletions

View File

@ -2378,6 +2378,7 @@ var
SizeRemaining, sz: Cardinal;
Offs: Integer;
APartAddr: TDBGPtr;
Dummy: QWord;
begin
// subclasses can do better implementation if checking for error reasons, such as part_read
APartSize := ASize;
@ -2390,6 +2391,11 @@ begin
APartAddr := AAdress;
APartSize := 0;
// check if the address is readable at all
Result := ReadData(AAdress, 1, Dummy);
if not Result then
exit;
while SizeRemaining > 0 do begin
Result := False;
sz := SizeRemaining;

View File

@ -1080,6 +1080,7 @@ function TFpDbgMemReaderBase.ReadMemoryPartial(AnAddress: TDbgPtr;
var
SizeRemaining, sz: Cardinal;
Offs: Integer;
Dummy: QWord;
begin
ABytesRead := ASize;
Result := ReadMemory(AnAddress, ASize, ADest);
@ -1090,6 +1091,11 @@ begin
Offs := 0;
ABytesRead := 0;
// check if the address is readable at all
Result := ReadMemory(AnAddress, 1, @Dummy);
if not Result then
exit;
while SizeRemaining > 0 do begin
Result := False;
sz := SizeRemaining;