mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 06:09:14 +02:00
debugger: made checking partial stack trace more robust, as suggested by Yuri
git-svn-id: trunk@11295 -
This commit is contained in:
parent
b3246f94ce
commit
2a4f00b5ec
@ -2640,18 +2640,21 @@ begin
|
|||||||
if cnt = -1 then
|
if cnt = -1 then
|
||||||
begin
|
begin
|
||||||
{ In case of error some stackframes still can be accessed.
|
{ In case of error some stackframes still can be accessed.
|
||||||
Trying to find out how many... }
|
Trying to find out how many...
|
||||||
i:=0;
|
We try maximum 40 frames, because sometimes a corrupt stack and a bug in
|
||||||
|
gdb may cooperate, so that -stack-info-depth X returns always X }
|
||||||
repeat
|
repeat
|
||||||
Inc(i);
|
inc(i);
|
||||||
TGDBMIDebugger(Debugger).ExecuteCommand('-stack-info-depth ' + IntToStr(i),
|
TGDBMIDebugger(Debugger).ExecuteCommand('-stack-info-depth ' + IntToStr(i),
|
||||||
[cfIgnoreError], R);
|
[cfIgnoreError], R);
|
||||||
List := CreateMIValueList(R);
|
List := CreateMIValueList(R);
|
||||||
cnt := StrToIntDef(List.Values['depth'], -1);
|
cnt := StrToIntDef(List.Values['depth'], -1);
|
||||||
FreeAndNil(List);
|
FreeAndNil(List);
|
||||||
if cnt = -1 then
|
if (cnt = -1) then begin
|
||||||
|
// no valid stack-info-depth found, so the previous was the last valid one
|
||||||
cnt:=i - 1;
|
cnt:=i - 1;
|
||||||
until cnt < i;
|
end;
|
||||||
|
until (cnt<i) or (i=40);
|
||||||
end;
|
end;
|
||||||
SetCount(cnt);
|
SetCount(cnt);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user