diff options
author | Björn Gustavsson <[email protected]> | 2017-10-02 11:48:13 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-10-02 11:48:13 +0200 |
commit | 883ceaec7d5e6c84490de9d766878b1c3877e046 (patch) | |
tree | b65db696bd93bca3bfebf52f5bd9c65bca2f6599 /erts/emulator/test | |
parent | 8813b9ff2cc9351d174b1faaba336b2e7ad2d512 (diff) | |
parent | 9a50a5d5fc1c74d91efad74e1cb3e78f38e2b75c (diff) | |
download | otp-883ceaec7d5e6c84490de9d766878b1c3877e046.tar.gz otp-883ceaec7d5e6c84490de9d766878b1c3877e046.tar.bz2 otp-883ceaec7d5e6c84490de9d766878b1c3877e046.zip |
Merge pull request #1589 from bjorng/bjorn/erts/instruction-offsets
Point out the correct line number in stack traces
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/exception_SUITE.erl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/erts/emulator/test/exception_SUITE.erl b/erts/emulator/test/exception_SUITE.erl index e473a10be7..0f27251fcb 100644 --- a/erts/emulator/test/exception_SUITE.erl +++ b/erts/emulator/test/exception_SUITE.erl @@ -662,6 +662,15 @@ line_numbers(Config) when is_list(Config) -> {?MODULE,line_numbers,1,_}|_]}} = (catch applied_bif_2()), + {'EXIT',{badarith, + [{?MODULE,increment1,1,[{file,"increment.erl"},{line,45}]}, + {?MODULE,line_numbers,1,_}|_]}} = + (catch increment1(x)), + {'EXIT',{badarith, + [{?MODULE,increment2,1,[{file,"increment.erl"},{line,48}]}, + {?MODULE,line_numbers,1,_}|_]}} = + (catch increment2(x)), + ok. id(I) -> I. @@ -762,3 +771,15 @@ applied_bif_2() -> %Line 8 R = process_info(self(), current_location), %Line 9 fail = R, %Line 10 ok. %Line 11 + +%% The increment instruction used to decrement the instruction +%% pointer, which would cause the line number in a stack trace to +%% be the previous line number. + +-file("increment.erl", 42). +increment1(Arg) -> %Line 43 + Res = id(Arg), %Line 44 + Res + 1. %Line 45 +increment2(Arg) -> %Line 46 + _ = id(Arg), %Line 47 + Arg + 1. %Line 48 |