aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/test/int_SUITE.erl
diff options
context:
space:
mode:
authorJosé Valim <[email protected]>2016-02-22 22:16:53 +0100
committerJosé Valim <[email protected]>2016-02-23 08:37:40 +0100
commitc7e82c6b406b632a191c791a1bd2162bde08f692 (patch)
tree699ff115ae3892e483d3a941edf17fe0b69616fa /lib/debugger/test/int_SUITE.erl
parente038cbe699acc19901e10b9569a3b783e900582d (diff)
downloadotp-c7e82c6b406b632a191c791a1bd2162bde08f692.tar.gz
otp-c7e82c6b406b632a191c791a1bd2162bde08f692.tar.bz2
otp-c7e82c6b406b632a191c791a1bd2162bde08f692.zip
Use compile source info in debugger
Prior to this commit, the debugger relied on a simple heuristic that traverses directory from the beam file to find a source file. The heuristic was maintained with this patch but, if it fails, it fallbacks to the source value in the module compile info. In order to illustrate how it works, one of the tests that could not find its source now passes successfully (showing the source lookup is more robust).
Diffstat (limited to 'lib/debugger/test/int_SUITE.erl')
-rw-r--r--lib/debugger/test/int_SUITE.erl18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/debugger/test/int_SUITE.erl b/lib/debugger/test/int_SUITE.erl
index 5f2e4dd84d..a4995e6ef4 100644
--- a/lib/debugger/test/int_SUITE.erl
+++ b/lib/debugger/test/int_SUITE.erl
@@ -245,14 +245,13 @@ interpretable(Config) when is_list(Config) ->
?line true = int:interpretable(filename:join([DataDir,lists1])),
?line true = code:del_path(DataDir),
- %% {error, no_src}
- ?line PrivDir = filename:join(?config(priv_dir, Config), ""),
- ?line {ok, _} = file:copy(filename:join([DataDir,"lists1.beam"]),
+ %% true (from source)
+ PrivDir = filename:join(?config(priv_dir, Config), ""),
+ {ok, _} = file:copy(filename:join([DataDir,"lists1.beam"]),
filename:join([PrivDir,"lists1.beam"])),
- ?line true = code:add_patha(PrivDir),
-
- ?line {error, no_src} = int:interpretable(lists1),
- ?line ok = file:delete(filename:join([PrivDir,"lists1.beam"])),
+ true = code:add_patha(PrivDir),
+ true = int:interpretable(lists1),
+ ok = file:delete(filename:join([PrivDir,"lists1.beam"])),
%% {error, no_beam}
Src = filename:join([PrivDir,"lists1.erl"]),
@@ -267,6 +266,11 @@ interpretable(Config) when is_list(Config) ->
?line ok = file:delete(Src),
?line true = code:del_path(PrivDir),
+ %% {error, no_src}
+ {ok, lists2, Binary} = compile:forms([{attribute,1,module,lists2}], []),
+ code:load_binary(lists2, "unknown", Binary),
+ {error, no_src} = int:interpretable(lists2),
+
%% {error, badarg}
?line {error, badarg} = int:interpretable(pride),
?line {error, badarg} = int:interpretable("prejudice.erl"),