Browse Source

* CaptureBacktrace: fixed off-by-one error. Caller's context must be captured if skipframes=0.

git-svn-id: trunk@29691 -
sergei 10 years ago
parent
commit
438c433c50
1 changed files with 2 additions and 2 deletions
  1. 2 2
      rtl/inc/system.inc

+ 2 - 2
rtl/inc/system.inc

@@ -1081,14 +1081,14 @@ begin
   while (i<count) and (curr_frame>prev_frame) and
      (curr_frame<StackTop) do
     begin
-      prev_frame:=curr_frame;
-      get_caller_stackinfo(curr_frame,curr_addr);
       if (curr_addr=nil) or
          (curr_frame=nil) then
         break;
       if (i>=0) then
         frames[i]:=curr_addr;
       inc(i);
+      prev_frame:=curr_frame;
+      get_caller_stackinfo(curr_frame,curr_addr);
     end;
   if i<0 then
     result:=0