summaryrefslogtreecommitdiff
path: root/src/rebar_otp_app.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_otp_app.erl')
-rw-r--r--src/rebar_otp_app.erl22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl
index e850e58..2b5f682 100644
--- a/src/rebar_otp_app.erl
+++ b/src/rebar_otp_app.erl
@@ -166,23 +166,15 @@ ebin_modules(App, Dir) ->
[rebar_utils:beam_to_mod(N) || N <- Filtered].
beam_src(Beam) ->
- try
- Mod = list_to_atom(filename:basename(Beam, ".beam")),
- _ = purge(Mod),
- {module, Mod} = code:load_abs(filename:rootname(Beam, ".beam")),
- Compile = Mod:module_info(compile),
- proplists:get_value(source, Compile, [])
- catch
- error:undef -> [];
- error:nofile -> []
+ case beam_lib:chunks(Beam, [compile_info]) of
+ {ok, {_mod, Chunks}} ->
+ CompileInfo = proplists:get_value(compile_info, Chunks, []),
+ proplists:get_value(source, CompileInfo, []);
+ {error, beam_lib, Reason} ->
+ ?WARN("Couldn't read debug info from ~p for reason: ~p", [Beam, Reason]),
+ []
end.
-purge(Mod) ->
- %% remove old code if necessary
- _ = code:purge(Mod),
- %% move current code to old
- _ = code:delete(Mod).
-
ensure_registered(AppData) ->
case lists:keyfind(registered, 1, AppData) of
false ->