debugger: show at least partial stack trace, if the complete stack trace cannot be reconstructed (#8908) from Yuri

git-svn-id: trunk@11293 -
This commit is contained in:
vincents 2007-06-07 11:22:35 +00:00
parent 4512cc87b8
commit ba3e478722

View File

@ -2627,6 +2627,7 @@ function TGDBMICallStack.CheckCount: Boolean;
var
R: TGDBMIExecResult;
List: TStrings;
i, cnt: longint;
begin
Result := inherited CheckCount;
if not Result then Exit;
@ -2634,8 +2635,25 @@ begin
TGDBMIDebugger(Debugger).ExecuteCommand('-stack-info-depth',
[cfIgnoreError], R);
List := CreateMIValueList(R);
SetCount(StrToIntDef(List.Values['depth'], 0));
cnt := StrToIntDef(List.Values['depth'], -1);
FreeAndNil(List);
if cnt = -1 then
begin
{ In case of error some stackframes still can be accessed.
Trying to find out how many... }
i:=0;
repeat
Inc(i);
TGDBMIDebugger(Debugger).ExecuteCommand('-stack-info-depth ' + IntToStr(i),
[cfIgnoreError], R);
List := CreateMIValueList(R);
cnt := StrToIntDef(List.Values['depth'], -1);
FreeAndNil(List);
if cnt = -1 then
cnt:=i - 1;
until cnt < i;
end;
SetCount(cnt);
end;
function TGDBMICallStack.CreateStackEntry(const AIndex: Integer): TCallStackEntry;