LazDebuggerFp: Variant-converter, check record size.

This commit is contained in:
Martin 2022-07-13 09:37:36 +02:00
parent d0d616e131
commit 4bc63f4650

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, fgl, FpDbgInfo, FpdMemoryTools, FpDbgCallContextInfo, Classes, SysUtils, fgl, FpDbgInfo, FpdMemoryTools, FpDbgCallContextInfo,
FpPascalBuilder, FpErrorMessages, FpDbgClasses, DbgIntfBaseTypes, FpPascalBuilder, FpErrorMessages, FpDbgClasses, FpDbgUtil, DbgIntfBaseTypes,
lazCollections, LazClasses, LCLProc, FpDebugDebuggerBase; lazCollections, LazClasses, LCLProc, FpDebugDebuggerBase;
type type
@ -309,24 +309,25 @@ var
r: Boolean; r: Boolean;
begin begin
Result := nil; Result := nil;
if not ( if (ASourceValue.Kind <> skRecord) or
(ASourceValue.Kind = skRecord) and (AnFpDebugger.DbgController.CurrentProcess = nil) or
( (ASourceValue.MemberCount = 0) or ( (AnFpDebugger.DbgController.CurrentProcess.Mode = dm32) and
(ASourceValue.MemberCount >= 2) (ASourceValue.DataSize.Size <> 16)
) ) ) or
( (AnFpDebugger.DbgController.CurrentProcess.Mode = dm64) and
(ASourceValue.DataSize.Size <> 24)
)
then begin then begin
SetError(CreateError(fpErrAnyError, ['Value not a variant'])); SetError(CreateError(fpErrAnyError, ['Value not a variant']));
exit; exit;
end; end;
if (ASourceValue.MemberCount >= 2) then begin m := ASourceValue.MemberByName['vtype'];
m := ASourceValue.Member[0]; r := (m = nil) or (SizeToFullBytes(m.DataSize) <> 2);
r := SizeToFullBytes(m.DataSize) <> 2;
m.ReleaseReference; m.ReleaseReference;
if r then begin if r then begin
SetError(CreateError(fpErrAnyError, ['Value not a variant'])); SetError(CreateError(fpErrAnyError, ['Value not a variant']));
exit; exit;
end; end;
end;
ProcVal := nil; ProcVal := nil;
ProcSym := nil; ProcSym := nil;