mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 19:49:36 +02:00
* enable the compiler to optimize away parts of System.PushExceptObject, if System.get_frame is not implemented, i.e. returning nil
git-svn-id: trunk@47058 -
This commit is contained in:
parent
ab9fa2012b
commit
c9fcc68ec1
@ -101,40 +101,43 @@ begin
|
|||||||
writeln ('In PushExceptObject');
|
writeln ('In PushExceptObject');
|
||||||
{$endif}
|
{$endif}
|
||||||
_ExceptObjectStack:=@ExceptObjectStack;
|
_ExceptObjectStack:=@ExceptObjectStack;
|
||||||
New(NewObj);
|
NewObj:=AllocMem(sizeof(TExceptObject));
|
||||||
NewObj^.Next:=_ExceptObjectStack^;
|
NewObj^.Next:=_ExceptObjectStack^;
|
||||||
_ExceptObjectStack^:=NewObj;
|
_ExceptObjectStack^:=NewObj;
|
||||||
|
|
||||||
NewObj^.FObject:=Obj;
|
NewObj^.FObject:=Obj;
|
||||||
NewObj^.Addr:=AnAddr;
|
NewObj^.Addr:=AnAddr;
|
||||||
NewObj^.refcount:=0;
|
if assigned(get_frame) then
|
||||||
|
begin
|
||||||
|
NewObj^.refcount:=0;
|
||||||
|
|
||||||
{ Backtrace }
|
{ Backtrace }
|
||||||
curr_frame:=AFrame;
|
curr_frame:=AFrame;
|
||||||
curr_addr:=AnAddr;
|
curr_addr:=AnAddr;
|
||||||
frames:=nil;
|
frames:=nil;
|
||||||
framecount:=0;
|
framecount:=0;
|
||||||
framebufsize:=0;
|
framebufsize:=0;
|
||||||
{ The frame pointer of this procedure is used as initial stack bottom value. }
|
{ The frame pointer of this procedure is used as initial stack bottom value. }
|
||||||
prev_frame:=get_frame;
|
prev_frame:=get_frame;
|
||||||
while (framecount<RaiseMaxFrameCount) and (curr_frame > prev_frame) and
|
while (framecount<RaiseMaxFrameCount) and (curr_frame > prev_frame) and
|
||||||
(curr_frame<StackTop) do
|
(curr_frame<StackTop) do
|
||||||
Begin
|
Begin
|
||||||
prev_frame:=curr_frame;
|
prev_frame:=curr_frame;
|
||||||
get_caller_stackinfo(curr_frame,curr_addr);
|
get_caller_stackinfo(curr_frame,curr_addr);
|
||||||
if (curr_addr=nil) or
|
if (curr_addr=nil) or
|
||||||
(curr_frame=nil) then
|
(curr_frame=nil) then
|
||||||
break;
|
break;
|
||||||
if (framecount>=framebufsize) then
|
if (framecount>=framebufsize) then
|
||||||
begin
|
begin
|
||||||
inc(framebufsize,16);
|
inc(framebufsize,16);
|
||||||
reallocmem(frames,framebufsize*sizeof(codepointer));
|
reallocmem(frames,framebufsize*sizeof(codepointer));
|
||||||
end;
|
end;
|
||||||
frames[framecount]:=curr_addr;
|
frames[framecount]:=curr_addr;
|
||||||
inc(framecount);
|
inc(framecount);
|
||||||
End;
|
End;
|
||||||
NewObj^.framecount:=framecount;
|
NewObj^.framecount:=framecount;
|
||||||
NewObj^.frames:=frames;
|
NewObj^.frames:=frames;
|
||||||
|
end;
|
||||||
Result:=NewObj;
|
Result:=NewObj;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user