aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tools')
-rw-r--r--lib/tools/src/eprof.erl8
-rw-r--r--lib/tools/test/eprof_SUITE.erl12
2 files changed, 15 insertions, 5 deletions
diff --git a/lib/tools/src/eprof.erl b/lib/tools/src/eprof.erl
index bb082a4c66..c25eb4479c 100644
--- a/lib/tools/src/eprof.erl
+++ b/lib/tools/src/eprof.erl
@@ -174,7 +174,7 @@ handle_call({profile, Rootset, Pattern, M,F,A}, From, #state{fd = Fd } = S) ->
pattern = Pattern
}};
false ->
- exit(Pid, kill),
+ exit(Pid, eprof_kill),
{reply, error, #state{ fd = Fd}}
end;
@@ -255,12 +255,10 @@ handle_cast(_Msg, State) ->
%%
%% -------------------------------------------------------------------- %%
-handle_info({trace, _Pid, _Cmd, _Type}, S) ->
- {noreply, S};
-handle_info({trace, _Parent, spawn, _Pid, _Mfa}, S) ->
- {noreply, S};
handle_info({'EXIT', _, normal}, S) ->
{noreply, S};
+handle_info({'EXIT', _, eprof_kill}, S) ->
+ {noreply, S};
handle_info({'EXIT', _, Reason}, #state{ reply = FromTag } = S) ->
set_process_trace(false, S#state.rootset),
diff --git a/lib/tools/test/eprof_SUITE.erl b/lib/tools/test/eprof_SUITE.erl
index cad67fd617..67607c6cf2 100644
--- a/lib/tools/test/eprof_SUITE.erl
+++ b/lib/tools/test/eprof_SUITE.erl
@@ -59,6 +59,7 @@ basic(Config) when is_list(Config) ->
?line profiling_stopped = eprof:stop_profiling(),
%% with fun
+
?line {ok, _} = eprof:profile(fun() -> eprof_test:go(10) end),
?line profiling = eprof:profile([self()]),
?line {error, already_profiling} = eprof:profile(fun() -> eprof_test:go(10) end),
@@ -72,6 +73,17 @@ basic(Config) when is_list(Config) ->
?line {ok, _} = eprof:profile([], fun() -> eprof_test:go(10) end, {eprof_test, go, 1}),
?line {ok, _} = eprof:profile([], fun() -> eprof_test:go(10) end, {eprof_test, dec, 1}),
+ %% error case
+
+ ?line error = eprof:profile([Pid], fun() -> eprof_test:go(10) end),
+ ?line Pid = whereis(eprof),
+ ?line error = eprof:profile([Pid], fun() -> eprof_test:go(10) end),
+ ?line A = spawn(fun() -> receive _ -> ok end end),
+ ?line profiling = eprof:profile([A]),
+ ?line true = exit(A, kill_it),
+ ?line profiling_stopped = eprof:stop_profiling(),
+ ?line {error,_} = eprof:profile(fun() -> a = b end),
+
%% with mfa
?line {ok, _} = eprof:profile([], eprof_test, go, [10]),