mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 21:09:11 +02:00
* Win64 SEH: don't call RunError in exception handler, because it always prints backtrace from caller's context. Instead, print the correct backtrace explicitly.
git-svn-id: trunk@29678 -
This commit is contained in:
parent
cd166e6ff6
commit
896c1ff6d6
@ -375,6 +375,8 @@ label L1;
|
|||||||
var
|
var
|
||||||
exc: PExceptObject;
|
exc: PExceptObject;
|
||||||
obj: TObject;
|
obj: TObject;
|
||||||
|
hstdout: ^text;
|
||||||
|
i,code: Longint;
|
||||||
begin
|
begin
|
||||||
if (rec.ExceptionFlags and EXCEPTION_UNWIND)=0 then
|
if (rec.ExceptionFlags and EXCEPTION_UNWIND)=0 then
|
||||||
begin
|
begin
|
||||||
@ -391,7 +393,19 @@ begin
|
|||||||
begin
|
begin
|
||||||
Exc:=ExceptObjectStack;
|
Exc:=ExceptObjectStack;
|
||||||
if Exc^.FObject=nil then
|
if Exc^.FObject=nil then
|
||||||
RunError(abs(RunErrorCodex64(rec,context))) // !!prints wrong backtrace
|
begin
|
||||||
|
hstdout:=@stdout;
|
||||||
|
code:=abs(RunErrorCodex64(rec,context));
|
||||||
|
Writeln(hstdout^,'Runtime error ',code,' at $',hexstr(Exc^.addr));
|
||||||
|
Writeln(hstdout^,BackTraceStrFunc(Exc^.Addr));
|
||||||
|
if (Exc^.FrameCount>0) then
|
||||||
|
begin
|
||||||
|
for i:=0 to Exc^.FrameCount-1 do
|
||||||
|
Writeln(hstdout^,BackTraceStrFunc(Exc^.Frames[i]));
|
||||||
|
end;
|
||||||
|
Writeln(hstdout^,'');
|
||||||
|
Halt(code);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ if ExceptObjProc=nil, ExceptProc is typically also nil,
|
{ if ExceptObjProc=nil, ExceptProc is typically also nil,
|
||||||
@ -404,8 +418,10 @@ begin
|
|||||||
L1:
|
L1:
|
||||||
{ RtlUnwindEx above resets execution context to the point where the handler
|
{ RtlUnwindEx above resets execution context to the point where the handler
|
||||||
was installed, i.e. main_wrapper. It makes exiting this procedure no longer
|
was installed, i.e. main_wrapper. It makes exiting this procedure no longer
|
||||||
possible, halting is the only possible action here. }
|
possible. Halting is the only possible action here.
|
||||||
RunError(217);
|
Furthermore, this is not expected to execute at all, because the above block
|
||||||
|
definitely halts. }
|
||||||
|
Halt(217);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
result:=ExceptionContinueSearch;
|
result:=ExceptionContinueSearch;
|
||||||
|
Loading…
Reference in New Issue
Block a user