* Win64: Use separate implementation of CaptureBacktrace that calls RtlCaptureStackBackTrace. This way it does not require non-optimized code to work correctly.

git-svn-id: trunk@29692 -
This commit is contained in:
sergei 2015-02-14 11:41:33 +00:00
parent 438c433c50
commit d93d36e6d3
3 changed files with 9 additions and 0 deletions

View File

@ -1067,6 +1067,7 @@ begin
end;
{$ifndef FPC_SYSTEM_HAS_CAPTUREBACKTRACE}
function CaptureBacktrace(skipframes,count:sizeint;frames:PCodePointer):sizeint;
var
curr_frame,prev_frame: pointer;
@ -1095,6 +1096,7 @@ begin
else
result:=i;
end;
{$endif FPC_SYSTEM_HAS_CAPTUREBACKTRACE}
Procedure HandleErrorAddrFrame (Errno : longint;addr : CodePointer; frame : Pointer);[public,alias:'FPC_BREAK_ERROR']; {$ifdef CPUI386} register; {$endif}

View File

@ -213,6 +213,12 @@ type
end;
function CaptureBacktrace(skipframes,count:sizeint;frames:PCodePointer):sizeint;
begin
{ skipframes is increased because this function adds a call level }
Result:=RtlCaptureStackBackTrace(skipframes+1,count,frames^,nil);
end;
{ note: context must be passed by value, so modifications are made to a local copy }
function GetBacktrace(Context: TContext; StartingFrame: Pointer; out Frames: PPointer): Longint;
var

View File

@ -31,6 +31,7 @@ interface
{$ifdef FPC_USE_WIN64_SEH}
{$define FPC_SYSTEM_HAS_RAISEEXCEPTION}
{$define FPC_SYSTEM_HAS_RERAISE}
{$define FPC_SYSTEM_HAS_CAPTUREBACKTRACE}
{$endif FPC_USE_WIN64_SEH}
{ include system-independent routine headers }