aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/src/int.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/debugger/src/int.erl')
-rw-r--r--lib/debugger/src/int.erl18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/debugger/src/int.erl b/lib/debugger/src/int.erl
index 4f54beb45b..1e43d1858a 100644
--- a/lib/debugger/src/int.erl
+++ b/lib/debugger/src/int.erl
@@ -547,7 +547,7 @@ load({Mod, Src, Beam, BeamBin, Exp, Abst}, Dist) ->
check_module(Mod) ->
case code:which(Mod) of
Beam when is_list(Beam) ->
- case find_src(Beam) of
+ case find_src(Mod, Beam) of
Src when is_list(Src) ->
check_application(Src),
case check_beam(Beam) of
@@ -608,7 +608,7 @@ check_application2("gs-"++_) -> throw({error,{app,gs}});
check_application2("debugger-"++_) -> throw({error,{app,debugger}});
check_application2(_) -> ok.
-find_src(Beam) ->
+find_src(Mod, Beam) ->
Src0 = filename:rootname(Beam) ++ ".erl",
case is_file(Src0) of
true -> Src0;
@@ -618,10 +618,22 @@ find_src(Beam) ->
filename:basename(Src0)]),
case is_file(Src) of
true -> Src;
- false -> error
+ false -> find_src_from_module(Mod)
end
end.
+find_src_from_module(Mod) ->
+ Compile = Mod:module_info(compile),
+ case lists:keyfind(source, 1, Compile) of
+ {source, Src} ->
+ case is_file(Src) of
+ true -> Src;
+ false -> error
+ end;
+ false ->
+ error
+ end.
+
find_beam(Mod, Src) ->
SrcDir = filename:dirname(Src),
BeamFile = atom_to_list(Mod) ++ code:objfile_extension(),