aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/src/dbg_iload.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/debugger/src/dbg_iload.erl')
-rw-r--r--lib/debugger/src/dbg_iload.erl44
1 files changed, 10 insertions, 34 deletions
diff --git a/lib/debugger/src/dbg_iload.erl b/lib/debugger/src/dbg_iload.erl
index 1216338006..ccfe3ff234 100644
--- a/lib/debugger/src/dbg_iload.erl
+++ b/lib/debugger/src/dbg_iload.erl
@@ -18,19 +18,15 @@
%%
-module(dbg_iload).
-%% External exports
-export([load_mod/4]).
-%% Internal exports
--export([load_mod1/4]).
-
%%====================================================================
%% External exports
%%====================================================================
%%--------------------------------------------------------------------
%% load_mod(Mod, File, Binary, Db) -> {ok, Mod}
-%% Mod = atom()
+%% Mod = module()
%% File = string() Source file (including path)
%% Binary = binary()
%% Db = ETS identifier
@@ -43,22 +39,19 @@
%%--------------------------------------------------------------------
load_mod(Mod, File, Binary, Db) ->
Flag = process_flag(trap_exit, true),
- Pid = spawn_link(?MODULE, load_mod1, [Mod, File, Binary, Db]),
+ Pid = spawn_link(fun () -> load_mod1(Mod, File, Binary, Db) end),
receive
{'EXIT', Pid, What} ->
process_flag(trap_exit, Flag),
What
end.
-%%====================================================================
-%% Internal exports
-%%====================================================================
+-spec load_mod1(module(), file:filename(), binary(), tid()) -> no_return().
load_mod1(Mod, File, Binary, Db) ->
store_module(Mod, File, Binary, Db),
exit({ok, Mod}).
-
%%====================================================================
%% Internal functions
%%====================================================================
@@ -84,7 +77,7 @@ store_module(Mod, File, Binary, Db) ->
Attr = store_forms(Forms, Mod, Db, Exp, []),
erase(mod_md5),
erase(current_function),
-% store_funs(Db, Mod),
+ %% store_funs(Db, Mod),
erase(vcount),
erase(funs),
erase(fun_count),
@@ -412,8 +405,7 @@ expr({call,Line,{remote,_,{atom,_,erlang},{atom,_,fault}},[_]=As}) ->
{dbg,Line,fault,expr_list(As)};
expr({call,Line,{remote,_,{atom,_,erlang},{atom,_,exit}},[_]=As}) ->
{dbg,Line,exit,expr_list(As)};
-expr({call,Line,{remote,_,{atom,_,erlang},{atom,_,apply}},As0})
- when length(As0) == 3 ->
+expr({call,Line,{remote,_,{atom,_,erlang},{atom,_,apply}},[_,_,_]=As0}) ->
As = expr_list(As0),
{apply,Line,As};
expr({call,Line,{remote,_,{atom,_,Mod},{atom,_,Func}},As0}) ->
@@ -521,15 +513,9 @@ expr(Other) ->
%% here as sys_pre_expand has transformed source.
is_guard_test({op,_,Op,L,R}) ->
- case erl_internal:comp_op(Op, 2) of
- true -> is_gexpr_list([L,R]);
- false -> false
- end;
+ erl_internal:comp_op(Op, 2) andalso is_gexpr_list([L,R]);
is_guard_test({call,_,{remote,_,{atom,_,erlang},{atom,_,Test}},As}) ->
- case erl_internal:type_test(Test, length(As)) of
- true -> is_gexpr_list(As);
- false -> false
- end;
+ erl_internal:type_test(Test, length(As)) andalso is_gexpr_list(As);
is_guard_test({atom,_,true}) -> true;
is_guard_test(_) -> false.
@@ -546,22 +532,12 @@ is_gexpr({call,_,{remote,_,{atom,_,erlang},{atom,_,F}},As}) ->
Ar = length(As),
case erl_internal:guard_bif(F, Ar) of
true -> is_gexpr_list(As);
- false ->
- case erl_internal:arith_op(F, Ar) of
- true -> is_gexpr_list(As);
- false -> false
- end
+ false -> erl_internal:arith_op(F, Ar) andalso is_gexpr_list(As)
end;
is_gexpr({op,_,Op,A}) ->
- case erl_internal:arith_op(Op, 1) of
- true -> is_gexpr(A);
- false -> false
- end;
+ erl_internal:arith_op(Op, 1) andalso is_gexpr(A);
is_gexpr({op,_,Op,A1,A2}) ->
- case erl_internal:arith_op(Op, 2) of
- true -> is_gexpr_list([A1,A2]);
- false -> false
- end;
+ erl_internal:arith_op(Op, 2) andalso is_gexpr_list([A1,A2]);
is_gexpr(_) -> false.
is_gexpr_list(Es) -> lists:all(fun (E) -> is_gexpr(E) end, Es).