mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 19:49:12 +02:00
* replaced fpcunit custom code to obtaining a caller site with a call to
CaptureBacktrace (prevents crashes when compiled with LLVM backend, and is generally more robust) git-svn-id: trunk@42093 -
This commit is contained in:
parent
332679e28a
commit
c330f5080c
@ -376,16 +376,14 @@ Const
|
|||||||
function CallerAddr: Pointer;
|
function CallerAddr: Pointer;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
bp,pcaddr : pointer;
|
address: CodePointer;
|
||||||
|
nframes: sizeint;
|
||||||
begin
|
begin
|
||||||
Result:=Nil;
|
nframes:=CaptureBacktrace(2,1,@address);
|
||||||
bp:=get_frame;
|
if nframes=1 then
|
||||||
pcaddr:=get_pc_addr;
|
result:=address
|
||||||
get_caller_stackinfo(bp,pcaddr);
|
else
|
||||||
if bp<>Nil then
|
result:=nil;
|
||||||
get_caller_stackinfo(bp,pcaddr);
|
|
||||||
result:=pcaddr;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function AddrsToStr(Addrs: Pointer): string;
|
function AddrsToStr(Addrs: Pointer): string;
|
||||||
|
Loading…
Reference in New Issue
Block a user