diff options
author | Björn Gustavsson <[email protected]> | 2018-11-01 06:19:52 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-11-06 10:16:53 +0100 |
commit | e7b3dcde36969be9442e05b18919ecb5b61bf6a4 (patch) | |
tree | 665c241adbc1a24dbae62a4b3339cfbc1d827c23 /lib/compiler/src/beam_trim.erl | |
parent | 9212ce67e22e3f45190ded62bea82291d084351d (diff) | |
download | otp-e7b3dcde36969be9442e05b18919ecb5b61bf6a4.tar.gz otp-e7b3dcde36969be9442e05b18919ecb5b61bf6a4.tar.bz2 otp-e7b3dcde36969be9442e05b18919ecb5b61bf6a4.zip |
beam_trim, beam_jump: Print Name/Arity if there is a crash
This will help investigation of compiler bugs.
Diffstat (limited to 'lib/compiler/src/beam_trim.erl')
-rw-r--r-- | lib/compiler/src/beam_trim.erl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_trim.erl b/lib/compiler/src/beam_trim.erl index 61dd94d456..13cbedf3c0 100644 --- a/lib/compiler/src/beam_trim.erl +++ b/lib/compiler/src/beam_trim.erl @@ -36,10 +36,15 @@ module({Mod,Exp,Attr,Fs0,Lc}, _Opts) -> {ok,{Mod,Exp,Attr,Fs,Lc}}. function({function,Name,Arity,CLabel,Is0}) -> - %%ok = io:fwrite("~w: ~p\n", [?LINE,{Name,Arity}]), - St = #st{safe=safe_labels(Is0, []),lbl=beam_utils:index_labels(Is0)}, - Is = trim(Is0, St, []), - {function,Name,Arity,CLabel,Is}. + try + St = #st{safe=safe_labels(Is0, []),lbl=beam_utils:index_labels(Is0)}, + Is = trim(Is0, St, []), + {function,Name,Arity,CLabel,Is} + catch + Class:Error:Stack -> + io:fwrite("Function: ~w/~w\n", [Name,Arity]), + erlang:raise(Class, Error, Stack) + end. trim([{kill,_}|_]=Is0, St, Acc) -> {Kills0,Is1} = splitwith(fun({kill,_}) -> true; |