aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-02-26 13:09:49 +0100
committerBjörn Gustavsson <[email protected]>2016-02-26 13:09:49 +0100
commitad847aa2f332230ea33d6a65953c9be1f22af551 (patch)
tree4b055fdcacb22d6da7a654c7310c279d0c478eb3 /lib/debugger/src
parentc1cd5526cad9d078238f638d6e2067b47d79cb54 (diff)
parentc7e82c6b406b632a191c791a1bd2162bde08f692 (diff)
downloadotp-ad847aa2f332230ea33d6a65953c9be1f22af551.tar.gz
otp-ad847aa2f332230ea33d6a65953c9be1f22af551.tar.bz2
otp-ad847aa2f332230ea33d6a65953c9be1f22af551.zip
Merge branch 'josevalim/debugger-path/OTP-13375'
* josevalim/debugger-path/OTP-13375: Use compile source info in debugger
Diffstat (limited to 'lib/debugger/src')
-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(),