4
%% Copyright Ericsson AB 2001-2011. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
21
-module(debugger_SUITE).
25
-include_lib("test_server/include/test_server.hrl").
27
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
28
init_per_group/2,end_per_group/2,
29
init_per_testcase/2,end_per_testcase/2,
30
app_test/1,erts_debug/1,encrypted_debug_info/1,
33
suite() -> [{ct_hooks,[ts_install_cth]}].
36
[app_test, erts_debug, no_abstract_code,
37
encrypted_debug_info].
42
init_per_suite(Config) ->
45
end_per_suite(_Config) ->
48
init_per_group(_GroupName, Config) ->
51
end_per_group(_GroupName, Config) ->
55
init_per_testcase(_Case, Config) ->
56
Dog=test_server:timetrap(?t:minutes(0.5)),
57
[{watchdog, Dog}|Config].
58
end_per_testcase(_Case, Config) ->
59
Dog=?config(watchdog, Config),
60
test_server:timetrap_cancel(Dog),
63
app_test(Config) when is_list(Config) ->
64
?line ?t:app_test(debugger),
67
erts_debug(Config) when is_list(Config) ->
71
no_abstract_code(Config) when is_list(Config) ->
72
?line PrivDir = ?config(priv_dir, Config),
73
?line Simple = filename:join(PrivDir, "simple"),
74
?line Source = Simple ++ ".erl",
75
?line BeamFile = Simple ++ ".beam",
76
?line simple_file(Source),
78
%% Compile module without abstract code.
79
CompileFlags = [{outdir,PrivDir}],
80
?line {ok,_} = compile:file(Source, CompileFlags),
81
?line error = int:i(Simple),
84
?line ok = file:delete(Source),
85
?line ok = file:delete(BeamFile),
89
encrypted_debug_info(Config) when is_list(Config) ->
90
try begin crypto:start(), crypto:info(), crypto:stop(), ok end of
92
encrypted_debug_info_1(Config)
95
{skip,"The crypto application is missing or broken"}
98
encrypted_debug_info_1(Config) ->
99
?line PrivDir = ?config(priv_dir, Config),
100
?line Simple = filename:join(PrivDir, "simple"),
101
?line Source = Simple ++ ".erl",
102
?line BeamFile = Simple ++ ".beam",
103
?line simple_file(Source),
106
Key = "_This a Crypto Key_",
107
CompileFlags = [{outdir,PrivDir},debug_info,{debug_info_key,Key}],
108
?line {ok,_} = compile:file(Source, CompileFlags),
111
?line ok = beam_lib:crypto_key_fun(simple_crypto_fun(Key)),
112
?line {module,simple} = int:i(Simple),
115
?line {ok,_} = beam_lib:clear_crypto_key_fun(),
116
?line error = int:i(Simple),
119
?line ok = file:delete(Source),
120
?line ok = file:delete(BeamFile),
124
simple_crypto_fun(Key) ->
126
({debug_info, des3_cbc, simple, _}) -> Key
131
simple_file(File, simple).
133
simple_file(File, Module) ->
134
simple_file(File, Module, member).
136
simple_file(File, Module, F) ->
137
B = list_to_binary(["-module(", atom_to_list(Module), "). "
143
atom_to_list(F), "(a, L). "]),
144
ok = file:write_file(File, B).