DBG: more checks on parentfp

git-svn-id: trunk@36404 -
This commit is contained in:
martin 2012-03-28 21:10:48 +00:00
parent 0a1779a998
commit 69c5e7d27f

View File

@ -11612,15 +11612,18 @@ var
var
R: TGDBMIExecResult;
List: TGDBMINameValueList;
ParentFp, Fp: String;
ParentFp, Fp, LastFp: String;
i, j, ThreadId: Integer;
FrameCache: PGDBMIDebuggerParentFrameCache;
ParentFpNum, FpNum, FpDiff, LastFpDiff: QWord;
FpDir: Integer;
begin
if FWatchValue <> nil
then ThreadId := FWatchValue.ThreadId
else ThreadId := FTheDebugger.FCurrentThreadId;
FrameCache := TGDBMIWatches(FTheDebugger.Watches).GetParentFPList(ThreadId);
List := nil;
try
i := length(FrameCache^.ParentFPList);
j := Max(i, aFrameIdx+1);
@ -11642,21 +11645,23 @@ var
end;
if ParentFp = '' then begin
FrameCache^.ParentFPList[aFrameIdx].parentfp := '-'; // mark as no parentfp
List.Free;
Exit(False);
end;
FrameCache^.ParentFPList[aFrameIdx].parentfp := ParentFp;
end;
if StrToQWordDef(ParentFp, 0) = 0 then begin
ParentFpNum := StrToQWordDef(ParentFp, 0);
if ParentFpNum = 0 then begin
FrameCache^.ParentFPList[aFrameIdx].parentfp := '-'; // mark as no parentfp
List.Free;
Exit(False);
end;
if List = nil
then List := TGDBMINameValueList.Create('');
LastFp := '';
LastFpDiff := 0;
FpDir := 0;
repeat
Inc(aFrameIdx);
i := length(FrameCache^.ParentFPList);
@ -11667,7 +11672,6 @@ var
Fp := FrameCache^.ParentFPList[aFrameIdx].Fp;
if Fp = '-'
then begin
List.Free;
Exit(False);
end;
@ -11676,7 +11680,6 @@ var
or (R.State = dsError)
then begin
FrameCache^.ParentFPList[aFrameIdx].Fp := '-'; // mark as no Fp (not accesible)
List.Free;
Exit(False);
end;
FStackFrameChanged := True; // Force UnSelectContext() to restore current frame
@ -11687,7 +11690,6 @@ var
or (R.State = dsError)
then begin
FrameCache^.ParentFPList[aFrameIdx].Fp := '-'; // mark as no Fp (not accesible)
List.Free;
Exit(False);
end;
List.Init(R.Values);
@ -11697,10 +11699,34 @@ var
FrameCache^.ParentFPList[aFrameIdx].Fp := Fp;
end;
end;
if FP = LastFp then // Propably top of stack, FP no longer changes
Exit(False);
LastFp := Fp;
// check that FP gets closer to ParentFp
FpNum := StrToQWordDef(Fp, 0);
if FpNum > ParentFpNum then begin
if FpDir = 1 then exit; // went to far
FpDir := -1;
FpDiff := FpNum - ParentFpNum;
end else begin
if FpDir = -1 then exit; // went to far
FpDir := 1;
FpDiff := ParentFpNum - FpNum;
end;
if (LastFpDiff <> 0) and (FpDir >= LastFpDiff) then
Exit(False);
LastFpDiff := FpDiff;
until ParentFP = Fp;
List.Free;
Result := True;
finally
List.Free;
end;
end;
function PascalizePointer(AString: String; const TypeCast: String = ''): String;