Commit Graph

83 Commits

Author SHA1 Message Date
nickysn
ff6b258379 * changed ExceptTryLevel from nativeint to objpasint
git-svn-id: trunk@27234 -
2014-03-23 12:42:57 +00:00
sergei
baa18dfcb4 * Introduced a new function CaptureBacktrace, using it to handle most of back-tracing in heaptrc unit.
* Use StackTop instead of StackBottom+StackLength in a few remaining locations.

git-svn-id: trunk@27141 -
2014-03-15 05:16:37 +00:00
sergei
2f05e8b389 * PushExceptObject and dump_stack: use get_caller_stackinfo instead of get_caller_addr and get_caller_frame.
git-svn-id: trunk@27094 -
2014-03-11 12:51:46 +00:00
sergei
a7563fd0c8 * Added {$ifdef ver2_6} around stuff which is no longer used but needed for bootstrapping.
git-svn-id: trunk@27038 -
2014-03-08 23:13:10 +00:00
sergei
04f32c2a01 * Do not attempt to retrieve caller context if initial frame is not between StackTop and frame pointer of current procedure (aka stack bottom). Reverts part of r21843, fixing regression of tests/test/cg/traise6.pp after r26843.
r26843 caused regression because it removed exception handlers, causing condition "if ExceptAddrStack<>nil" in HandleErrorAddrFrame() to become False, so it wasn't raising another exception (which would halt with code 217) but terminating directly with code 216.

git-svn-id: trunk@26850 -
2014-02-23 10:20:54 +00:00
sergei
b26e36431a * Instead of three individual try..except blocks in fpc_pushexceptobject, guard the entire procedure at the caller side (it is called only from fpc_raiseexception). This additionally guards against possible crashes in getmem() due to corrupted heap. Furthermore, try..except block is not necessary at all for such one-time purposes.
git-svn-id: trunk@26843 -
2014-02-22 17:18:21 +00:00
sergei
d004607876 * fpc_raiseexception does not return a result.
git-svn-id: trunk@26837 -
2014-02-22 15:18:31 +00:00
sergei
749ff6b19d * fpc_popobjectstack: clean up.
git-svn-id: trunk@26836 -
2014-02-22 14:44:29 +00:00
nickysn
f4f35ad47b * changed ExceptTryLevel from longint to nativeint (because i8086)
git-svn-id: trunk@26658 -
2014-02-03 00:48:11 +00:00
sergei
179586f589 + SEH support for Win32. Enable by cycling with OPT=-dTEST_WIN32_SEH.
Although basic things work (no regressions in test suite, also with TEST_OPT=-O2), there are some secondary issues/TODOs:
- Exception frame around PASCALMAIN is not properly removed in DLLs
- No stack traces yet
- Stack overallocated in finalizer procedures, their entry/exit code needs cleanup
- Signals unit is probably completely broken.

git-svn-id: trunk@26225 -
2013-12-12 12:43:46 +00:00
nickysn
c1b0fb81f1 * updated all the RTL helper functions related to exceptions and stack traces to use codepointer instead of pointer
git-svn-id: trunk@25513 -
2013-09-17 21:25:26 +00:00
nickysn
b688b79a0d * fixed the order of parameters in the first call to get_caller_frame in PushExceptObject
git-svn-id: trunk@25512 -
2013-09-17 21:20:24 +00:00
nickysn
1e28790e99 * fpc_PushExceptAddr's parameter Ft changed from LongInt to SmallInt on 16-bit CPUs for better efficiency
git-svn-id: branches/i8086@24036 -
2013-03-28 15:44:50 +00:00
nickysn
252903175c * TExceptAddr.frametype changed to SmallInt on 16-bit CPUs, since the compiler allocates 3*sizeof(pint) for the whole structure (and using longints on 16-bit CPUs is wasteful anyway)
git-svn-id: branches/i8086@24035 -
2013-03-28 15:34:38 +00:00
florian
92565c80ba * make exception variables threadvars or not depending on threading support
git-svn-id: trunk@23262 -
2012-12-31 19:31:22 +00:00
pierre
6eccf88499 call halt(217) if get_caller_XX function generates an exception
git-svn-id: trunk@22389 -
2012-09-14 13:45:31 +00:00
pierre
305a275746 Protect with try/except blocks call to get_caller_XXX functions to avoid troubles if stack is invalid
git-svn-id: trunk@22381 -
2012-09-13 12:37:49 +00:00
pierre
bc1ecc2e94 Use two parameter versions of get_caller_frame and get_caller_addr to get correct results for MIPS
git-svn-id: trunk@21843 -
2012-07-10 10:07:11 +00:00
sergei
cbad0abab5 + Platform-specific exception support for x86_64-win64. Enable by cycling with OPT=-dTEST_WIN64_SEH.
git-svn-id: trunk@20098 -
2012-01-16 23:13:31 +00:00
sergei
ebe1d74d6e * Moved multiple similar checks for FPC_HAS_FEATURE_EXITCODE and FPC_LIMITED_EXITCODE to Halt() procedure. Now these checks appear only once.
git-svn-id: trunk@19597 -
2011-11-05 16:48:12 +00:00
sergei
56900b4754 * RTL: clean up exception handling code (functionality is not changed).
* changed fpc_pushexceptobj to normal procedure, it does not need to be a compilerproc.

git-svn-id: trunk@19596 -
2011-11-05 16:28:37 +00:00
sergei
a32fdc3ae6 + Added a simple helper tcg.g_call, intended to replace allocallcpuregisters+a_call_name+deallocallcpuregisters sequence which is used all over the place.
* Refactored code generation for tcgonnonde and tcgtryexceptnode, simplifying both compiler and generated code. Merged compilerprocs called in sequence into larger ones (fpc_popobjectstack+fpc_destroyexception -> fpc_doneexception, fpc_popsecondobjectstack+fpc_destroyexception+fpc_reraise -> fpc_raise_nested).

git-svn-id: trunk@19506 -
2011-10-18 15:46:15 +00:00
sergei
fa4b78363c + Handle safecall exceptions with a dedicated compilerproc, simplifies compiler part and reduces generated code size.
git-svn-id: trunk@19414 -
2011-10-08 12:40:03 +00:00
paul
fcaac0ebe1 compiler,rtl - safecall handling:
- pass address to SafeCallException  method(rtl needed a modification)
  - improve code generation for regular safecall routines (not methods)
  - improve test - check that passed exception and address are valid

git-svn-id: trunk@14946 -
2010-02-27 04:41:52 +00:00
paul
bfb7d91b74 rtl: fix typos
git-svn-id: trunk@14935 -
2010-02-25 04:09:30 +00:00
yury
e475735c43 * ifdefed fatal error messages in exception handling to be available only if debugging is needed.
git-svn-id: trunk@9562 -
2007-12-28 20:10:19 +00:00
yury
99ea98c7b1 * Workaround dead code warnings by using preprocessor.
git-svn-id: trunk@9497 -
2007-12-21 21:49:47 +00:00
yury
3ab20922d6 * Optimization for code size. It saves 1.5KB for ARM and 0.5KB for i386.
git-svn-id: trunk@5329 -
2006-11-11 13:26:09 +00:00
Jonas Maebe
865a4573cf * exit with exitcode 217 instead of some random OS result
on an unhandled exception

git-svn-id: trunk@5314 -
2006-11-10 20:32:20 +00:00
yury
df6fec5301 * removed runtime error on unhandled exception when SysUtils is used.
git-svn-id: trunk@5273 -
2006-11-07 10:32:27 +00:00
florian
0089de9428 * improved exception handling code
git-svn-id: trunk@2632 -
2006-02-19 15:48:15 +00:00
florian
9e5a2f9522 * From Yury Sidorov:
* Now runtime error is not popped on program's exit if exception was handled. 

git-svn-id: trunk@601 -
2005-07-09 13:06:19 +00:00
florian
25b79e9db3 * patch from Yury Sidorov to make simply exception handling without sysutils possible
git-svn-id: trunk@595 -
2005-07-07 18:53:21 +00:00
peter
58cdeb8184 * give runerror 231 if exceptobjectstack=nil
git-svn-id: trunk@401 -
2005-06-14 05:22:18 +00:00
michael
5cafc069b5 + Removed NOSAVEREGISTERS define
git-svn-id: trunk@307 -
2005-06-09 17:58:20 +00:00
michael
859bb30daa + Removed HASTHREADVAR SUPPORT_THREADVAR defines
git-svn-id: trunk@295 -
2005-06-09 17:40:29 +00:00
michael
93ba0409be + Removed HASCOMPILERPROC define
git-svn-id: trunk@265 -
2005-06-07 21:41:02 +00:00
michael
5d02b2c6cc Removed HAS_ADDR_STACK_ON_STACK define
git-svn-id: trunk@261 -
2005-06-07 21:14:57 +00:00
peter
4ace790492 * remove $Log
git-svn-id: trunk@231 -
2005-06-07 09:47:55 +00:00
peter
87fe5d9b98 * limit backtraces to values inside the stack, patch by Vincent Snijders
git-svn-id: trunk@162 -
2005-06-01 06:50:52 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
michael
71f56b3d61 + Patch to return nil if there is no exception object (as in Delphi) 2005-05-08 21:20:26 +00:00
florian
cd86e40cb7 * ref. counting for popping second exceptiono object fixed 2005-04-03 11:32:05 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
peter
93ec8d154c * fix crash with backtrace if invalid frame is passed 2005-01-29 17:01:18 +00:00
peter
a68b710efd * retrieve backtrace when exception is raised
* RaiseMaxFrameCount added to limit the number of backtraces, setting
    it to 0 disables backtraces. Default is 16
2005-01-26 17:07:10 +00:00
peter
fd759e521f * saveregisters calling convention is obsolete 2004-10-24 20:01:41 +00:00
florian
2553988d5a * exception addr record size for 64 bit systems fixed 2004-04-27 18:47:51 +00:00
florian
c9122a4719 + completed x86-64/linux system unit 2004-02-05 01:16:12 +00:00