summaryrefslogtreecommitdiff
path: root/erts/emulator/test/exception_SUITE.erl
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'bjorn/erts/fix-wrong-class/ERIERL-367/OTP-15834' into maintBjörn Gustavsson2019-05-241-0/+34
|\ | | | | | | | | * bjorn/erts/fix-wrong-class/ERIERL-367/OTP-15834: Fix sticky class in exception
| * Fix sticky class in exceptionBjörn Gustavsson2019-05-231-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When catching an exception re-throwing with a changed class, the class could be changed to the original class if the exception got caught and rethrown in (for example) an after block: sticky_class() -> try try throw(reason) catch throw:Reason:Stack -> erlang:raise(error, Reason, Stack) end after ok end.
* | compiler: Introduce module-level type optimizationJohn Högberg2019-01-241-0/+5
|/ | | | | This commit lets the type optimization pass work across functions, tracking return and argument types to eliminate redundant tests.
* Update copyright yearHenrik Nord2018-06-181-1/+1
|
* Make stacktraces consistent when backtrace_depth is 0Björn Gustavsson2018-04-191-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is allowed to set the backtrace depth to 0, but when an exception is catched the stacktrace will still contain one element: 1> erlang:system_flag(backtrace_depth, 0). 8 2> catch error(badarg). {'EXIT',{badarg,[{shell,apply_fun,3, [{file,"shell.erl"},{line,908}]}]}} However, when an exception is raised using `erlang:raise/3`, there will be no elements in the stacktrace: 3> catch erlang:raise(error, badarg, [{fake,name,[arg],[]}]). {'EXIT',{badarg,[]}} Since the `error_handler` module uses `erlang:raise/3` to raise an exception when an undefined function is called, there will not be any stacktrace when calling an undefined function: 4> catch undef_module:undef_name(some_argument). {'EXIT',{undef,[]}} Fix this inconsistency by changing `erlang:raise/3` so that it always includes one element in the stacktrace: 3> catch erlang:raise(error, badarg, [{fake,name,[arg],[]}]). {'EXIT',{badarg,[{fake,name,[arg],[]}]}} 4> catch undef_module:undef_name(some_argument). {'EXIT',{undef,[{undef_module,undef_name,[some_argument],[]}]}}
* Use the new syntax in more test suitesBjörn Gustavsson2017-11-301-2/+2
|
* Explicitly disable HiPE's range analysisKostis Sagonas2017-10-101-0/+4
| | | | | when/if compiling this file to native code to check its exception behaiour. Related to the discussion in #1586.
* Point out the correct line number in stack tracesBjörn Gustavsson2017-09-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the line number in a stack trace could be wrong, for example for this code: t() -> Res = id(x), %<== Wrong line number. Res + 1. id(I) -> I. The line number pointed out in the stack trace would be the line before the line where the exception occurred. The reason is the way the increment instruction instruction is implemented: OpCase(i_increment_rWtd): { increment_reg_val = r(0); } I -= 1; goto increment__execute; OpCase(i_increment_xWtd): { increment_reg_val = xb(I[1]); } goto increment__execute; increment__execute: /* Common code for increment */ . . . (The implementation in OTP 20 is similar, but hand-coded directly in beam_emu.c instead of generated.) The instruction i_increment_rWtd decrements the instruction pointer (I) before jumping to the common code. That means that I points *before* the 'increment' instruction. If there is a 'line' instruction directly before the 'increment' instruction (as there is in this example), the instruction pointer will point before that line. Thus the previous line will be picked up instead. To eliminate this bug, we must never decrement the instruction pointer. Instead, we can increment the other (longer) instructions in the same group of combined instructions: OpCase(i_increment_rWtd): { increment_reg_val = r(0); } goto increment__execute; OpCase(i_increment_xWtd): { increment_reg_val = xb(I[1]); } I += 1; goto increment__execute; increment__execute: /* Common code for increment */ . . . Also fix a bug that was only a potential bug when ddaed7774eb0a introduced relative jumps, but is now a real bug. See the added comment for SET_I_REL() in macros.tab.
* josevalim/jv-op-stacktrace-entry/PR-1478/OTP-14508Lukas Larsson2017-07-101-13/+69
|\ | | | | Add stacktrace entries to BIF calls from emulator
| * Add stacktrace entries to BIF calls from emulatorJosé Valim2017-07-071-13/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this change is to improve debugging of emulator calls. For example, the following code rem(1, y) will error with atom `badarith` when y is 0 and the stacktrace has no entry for `erlang:rem/2`, making such cases very hard to debug. This patch makes it so the stacktrace includes `erlang:rem(1, 0)`. The following emulator BIFs have been changed: * band/2 * bnot/1 * bor/2 * bsl/2 * bsr/2 * bxor/2 * div/2 * element/2 * int_div/2 * rem/2 * sminus/2 * splus/2 * stimes/2
* | Update copyright yearHans Nilsson2017-06-141-1/+1
| |
* | Lengthen too short timetrapsBjörn Gustavsson2017-06-031-1/+1
|/ | | | | | | | c062dfc485a added timetraps to test suites that had no timetraps. Some of added timetraps are only 5 or 10 seconds, which is can be too short time on some slow computers. Change those times to one or two minutes.
* update copyright-yearHenrik Nord2016-03-151-1/+1
|
* Remove ?line macrosBjörn-Egil Dahlberg2016-03-111-302/+302
|
* Eliminate use of test_server:fail/0,1Björn-Egil Dahlberg2016-03-111-4/+4
|
* Modernize use of timetrapsBjörn-Egil Dahlberg2016-03-111-19/+4
|
* Eliminate use of test_server.hrl and test_server_line.hrlBjörn Gustavsson2016-02-171-1/+1
| | | | | | | As a first step to removing the test_server application as as its own separate application, change the inclusion of test_server.hrl to an inclusion of ct.hrl and remove the inclusion of test_server_line.hrl.
* Change license text to APLv2Bruce Yinhe2015-06-181-10/+11
|
* compiler: Correct line number in exception from binary constructionBjörn Gustavsson2014-01-161-0/+11
| | | | Reported-by: Stanislav Seletskiy
* exception_SUITE: Test line numbers in exceptionsBjörn Gustavsson2011-08-181-2/+178
|
* Lookup and include filenames and line numbers in exceptionsBjörn Gustavsson2011-08-161-11/+11
|
* emulator: Add a fourth element in exception stacktracesBjörn Gustavsson2011-08-161-22/+28
| | | | | | | | | | | | | | | | | | | | | | | | This commit is a preparation for introducing location information (filename/line number) in stacktraces in exceptions. Currently a stack trace looks like: [{Mod1,Function1,Arity1}, . . . {ModN,FunctionN,ArityN}] Add a forth element to each tuple that can be used indication the filename and line number of the source file: [{Mod1,Function1,Arity1,Location1}, . . . {ModN,FunctionN,ArityN,LocationN}] In this commit, the fourth element will just be an empty list, and we will change all code that look at or manipulate stacktraces.
* Fix duplicate entries in stacktraces after calling certain BIFsBjörn Gustavsson2011-03-291-1/+13
| | | | | | Calling a BIF thaf is called as a function (such as process_info/{1,2}) would leave a non-zero value in c_p->cp, which would lead to duplicate entries in the stacktrace.
* Update copyright yearsBjörn-Egil Dahlberg2011-03-111-1/+1
|
* Rename Suite Callback to Common Test HookLukas Larsson2011-02-171-1/+1
|
* Fix formatting for emulatorLukas Larsson2011-02-171-6/+8
|
* Add init_per_suite and end_per_suiteLukas Larsson2011-02-171-1/+7
|
* Add ts_install_scb to suite/0Lukas Larsson2011-02-171-1/+3
|
* Update emulator tests to conform with common_test standardLukas Larsson2011-02-171-7/+17
|
* The R13B03 release.OTP_R13B03Erlang/OTP2009-11-201-0/+497