mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 22:39:36 +02:00
* call DoUnhandledException instead of RunError(217) when the the psabi eh
unwinder returns an error (this is usually because there is no outer exception catching frame anymore -> unhandled exception) (based on patch by Cyrax, mantis #35751) git-svn-id: trunk@42999 -
This commit is contained in:
parent
a051b8d225
commit
617cc6984b
@ -135,6 +135,8 @@ function _Unwind_GetIP(context:PFPC_Unwind_Context):PtrUInt;cdecl;external;
|
|||||||
procedure _Unwind_SetIP(context:PFPC_Unwind_Context; new_value:PtrUInt);cdecl;external;
|
procedure _Unwind_SetIP(context:PFPC_Unwind_Context; new_value:PtrUInt);cdecl;external;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
procedure DoUnHandledException; forward;
|
||||||
|
|
||||||
{ _Unwind_Backtrace() is a gcc extension that walks the stack and calls the }
|
{ _Unwind_Backtrace() is a gcc extension that walks the stack and calls the }
|
||||||
{ _Unwind_Trace_Fn once per frame until it reaches the bottom of the stack }
|
{ _Unwind_Trace_Fn once per frame until it reaches the bottom of the stack }
|
||||||
{ or the _Unwind_Trace_Fn function returns something other than _URC_NO_REASON. }
|
{ or the _Unwind_Trace_Fn function returns something other than _URC_NO_REASON. }
|
||||||
@ -898,7 +900,7 @@ function _FPC_psabieh_personality_v0(version: longint; actions: FPC_Unwind_Actio
|
|||||||
{$ifdef excdebug}
|
{$ifdef excdebug}
|
||||||
writeln('foreign exception or force unwind, and found type = found terminate; actions = $',hexstr(actions,sizeof(actions)*2),'; foreign exception ', foreign_exception);
|
writeln('foreign exception or force unwind, and found type = found terminate; actions = $',hexstr(actions,sizeof(actions)*2),'; foreign exception ', foreign_exception);
|
||||||
{$endif}
|
{$endif}
|
||||||
RunError(217);
|
DoUnHandledException;
|
||||||
end
|
end
|
||||||
{ can only perform cleanups when force-unwinding }
|
{ can only perform cleanups when force-unwinding }
|
||||||
else if handler_switch_value<0 then
|
else if handler_switch_value<0 then
|
||||||
@ -906,7 +908,7 @@ function _FPC_psabieh_personality_v0(version: longint; actions: FPC_Unwind_Actio
|
|||||||
{$ifdef excdebug}
|
{$ifdef excdebug}
|
||||||
writeln('foreign exception or force unwind, handler_switch_value < 0: ', handler_switch_value);
|
writeln('foreign exception or force unwind, handler_switch_value < 0: ', handler_switch_value);
|
||||||
{$endif}
|
{$endif}
|
||||||
RunError(217)
|
DoUnHandledException;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -916,7 +918,7 @@ function _FPC_psabieh_personality_v0(version: longint; actions: FPC_Unwind_Actio
|
|||||||
{$ifdef excdebug}
|
{$ifdef excdebug}
|
||||||
writeln('native exception and no force unwind, and force_terminate');
|
writeln('native exception and no force unwind, and force_terminate');
|
||||||
{$endif}
|
{$endif}
|
||||||
RunError(217);
|
DoUnHandledException;
|
||||||
end
|
end
|
||||||
else if handler_switch_value<0 then
|
else if handler_switch_value<0 then
|
||||||
begin
|
begin
|
||||||
@ -924,7 +926,7 @@ function _FPC_psabieh_personality_v0(version: longint; actions: FPC_Unwind_Actio
|
|||||||
{$ifdef excdebug}
|
{$ifdef excdebug}
|
||||||
writeln('native exception and no force unwind, and handler_switch_value<0: ', handler_switch_value);
|
writeln('native exception and no force unwind, and handler_switch_value<0: ', handler_switch_value);
|
||||||
{$endif}
|
{$endif}
|
||||||
RunError(217);
|
DoUnHandledException;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ For targets with pointers smaller than the word size, we must extend the
|
{ For targets with pointers smaller than the word size, we must extend the
|
||||||
@ -1006,11 +1008,11 @@ begin
|
|||||||
with _ExceptObjectStack^ do
|
with _ExceptObjectStack^ do
|
||||||
RaiseProc(FObject,Addr,FrameCount,Frames);
|
RaiseProc(FObject,Addr,FrameCount,Frames);
|
||||||
RaiseResult:=_Unwind_RaiseException(@ExceptWrapper^.unwind_exception);
|
RaiseResult:=_Unwind_RaiseException(@ExceptWrapper^.unwind_exception);
|
||||||
// should never return
|
// Only returns if there is no exception catching block anymore
|
||||||
{$ifdef excdebug}
|
{$ifdef excdebug}
|
||||||
writeln('_Unwind_RaiseException returned: ',RaiseResult);
|
writeln('_Unwind_RaiseException returned: ',RaiseResult);
|
||||||
{$endif}
|
{$endif}
|
||||||
Halt(217);
|
DoUnHandledException;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef FPC_PSABIEH_CPLUSPLUSSUPPORT}
|
{$ifdef FPC_PSABIEH_CPLUSPLUSSUPPORT}
|
||||||
@ -1036,7 +1038,7 @@ function FPC_psabi_begin_catch(exc:PFPC_Unwind_Exception): pointer; compilerproc
|
|||||||
{$ifdef excdebug}
|
{$ifdef excdebug}
|
||||||
writeln('begin catch for nested foreign exception');
|
writeln('begin catch for nested foreign exception');
|
||||||
{$endif}
|
{$endif}
|
||||||
halt(217);
|
DoUnHandledException;
|
||||||
end;
|
end;
|
||||||
// This is a wrong conversion, but as long as afterwards we only access
|
// This is a wrong conversion, but as long as afterwards we only access
|
||||||
// fields of PFPC_Unwind_Exception, it's fine
|
// fields of PFPC_Unwind_Exception, it's fine
|
||||||
@ -1173,7 +1175,7 @@ procedure fpc_ReRaise; [public,alias:'FPC_RERAISE']; compilerproc;
|
|||||||
ExceptObjectStack:=nil;
|
ExceptObjectStack:=nil;
|
||||||
__cxa_rethrow;
|
__cxa_rethrow;
|
||||||
{ should never be reached }
|
{ should never be reached }
|
||||||
RunError(217);
|
DoUnHandledException;
|
||||||
end
|
end
|
||||||
{$endif FPC_PSABIEH_CPLUSPLUSSUPPORT}
|
{$endif FPC_PSABIEH_CPLUSPLUSSUPPORT}
|
||||||
else
|
else
|
||||||
@ -1199,9 +1201,9 @@ procedure fpc_ReRaise; [public,alias:'FPC_RERAISE']; compilerproc;
|
|||||||
// #endif
|
// #endif
|
||||||
// #endif
|
// #endif
|
||||||
// Some sort of unwinding error.
|
// Some sort of unwinding error.
|
||||||
RunError(217);
|
DoUnHandledException;
|
||||||
end;
|
end;
|
||||||
RunError(217);
|
DoUnHandledException;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_RAISENESTED}
|
{$define FPC_SYSTEM_HAS_RAISENESTED}
|
||||||
@ -1240,7 +1242,7 @@ procedure fpc_raise_nested;compilerproc;
|
|||||||
else
|
else
|
||||||
dec(hp^.refcount);
|
dec(hp^.refcount);
|
||||||
_Unwind_RaiseException(@_ExceptObjectStack^.unwind_exception);
|
_Unwind_RaiseException(@_ExceptObjectStack^.unwind_exception);
|
||||||
RunError(217);
|
DoUnHandledException;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FPC_DummyPotentialRaise; nostackframe; assembler;
|
procedure FPC_DummyPotentialRaise; nostackframe; assembler;
|
||||||
|
Loading…
Reference in New Issue
Block a user