aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/src/dbg_ieval.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/debugger/src/dbg_ieval.erl')
-rw-r--r--lib/debugger/src/dbg_ieval.erl111
1 files changed, 57 insertions, 54 deletions
diff --git a/lib/debugger/src/dbg_ieval.erl b/lib/debugger/src/dbg_ieval.erl
index 2e88c35741..f4b6d488a5 100644
--- a/lib/debugger/src/dbg_ieval.erl
+++ b/lib/debugger/src/dbg_ieval.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1998-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -249,7 +249,7 @@ meta_loop(Debugged, Bs, #ieval{level=Le} = Ieval) ->
{sys, Debugged, {value,Val}} ->
{value, Val, Bs};
{sys, Debugged, {value,Val,Bs2}} ->
- {value, Val, Bs2};
+ {value, Val, merge_bindings(Bs2, Bs, Ieval)};
{sys, Debugged, {exception,{Class,Reason,Stk}}} ->
case get(exit_info) of
@@ -324,61 +324,64 @@ trace(What, Args) ->
trace(return, {_Le,{dbg_apply,_,_,_}}, _Bool) ->
ignore;
trace(What, Args, true) ->
- Str = case What of
- send ->
- {To,Msg} = Args,
- io_lib:format("==> ~w : ~p~n", [To, Msg]);
- receivex ->
- {Le, TimeoutP} = Args,
- Tail = case TimeoutP of
- true -> "with timeout~n";
- false -> "~n"
- end,
- io_lib:format(" (~w) receive " ++ Tail, [Le]);
-
- received when Args =:= null ->
- io_lib:format("~n", []);
- received -> % Args=Msg
- io_lib:format("~n<== ~p~n", [Args]);
-
- call ->
- {Called, {Le,Li,M,F,As}} = Args,
- case Called of
- extern ->
- io_lib:format("++ (~w) <~w> ~w:~w~s~n",
- [Le,Li,M,F,format_args(As)]);
- local ->
- io_lib:format("++ (~w) <~w> ~w~s~n",
- [Le,Li,F,format_args(As)])
- end;
- call_fun ->
- {Le,Li,F,As} = Args,
- io_lib:format("++ (~w) <~w> ~w~s~n",
- [Le, Li, F, format_args(As)]);
- return ->
- {Le,Val} = Args,
- io_lib:format("-- (~w) ~p~n", [Le, Val]);
-
-
- bif ->
- {Le,Li,M,F,As} = Args,
- io_lib:format("++ (~w) <~w> ~w:~w~s~n",
- [Le, Li, M, F, format_args(As)])
- end,
- dbg_icmd:tell_attached({trace_output, Str});
+ Fun = fun(P) -> format_trace(What, Args, P) end,
+ dbg_icmd:tell_attached({trace_output, Fun});
trace(_What, _Args, false) ->
ignore.
-format_args(As) when is_list(As) ->
- [$(,format_args1(As),$)];
-format_args(A) ->
- [$/,io_lib:format("~p", [A])].
+format_trace(What, Args, P) ->
+ case What of
+ send ->
+ {To,Msg} = Args,
+ io_lib:format("==> ~w : "++P++"~n", [To, Msg]);
+ receivex ->
+ {Le, TimeoutP} = Args,
+ Tail = case TimeoutP of
+ true -> "with timeout~n";
+ false -> "~n"
+ end,
+ io_lib:format(" (~w) receive " ++ Tail, [Le]);
+
+ received when Args =:= null ->
+ io_lib:format("~n", []);
+ received -> % Args=Msg
+ io_lib:format("~n<== "++P++"~n", [Args]);
+
+ call ->
+ {Called, {Le,Li,M,F,As}} = Args,
+ case Called of
+ extern ->
+ io_lib:format("++ (~w) <~w> ~w:~w~ts~n",
+ [Le,Li,M,F,format_args(As, P)]);
+ local ->
+ io_lib:format("++ (~w) <~w> ~w~ts~n",
+ [Le,Li,F,format_args(As, P)])
+ end;
+ call_fun ->
+ {Le,Li,F,As} = Args,
+ io_lib:format("++ (~w) <~w> ~w~ts~n",
+ [Le, Li, F, format_args(As, P)]);
+ return ->
+ {Le,Val} = Args,
+ io_lib:format("-- (~w) "++P++"~n", [Le, Val]);
+
+
+ bif ->
+ {Le,Li,M,F,As} = Args,
+ io_lib:format("++ (~w) <~w> ~w:~w~ts~n",
+ [Le, Li, M, F, format_args(As, P)])
+ end.
+
+format_args(As, P) when is_list(As) ->
+ [$(,format_args1(As, P),$)];
+format_args(A, P) ->
+ [$/,io_lib:format(P, [A])].
-format_args1([A]) ->
- [io_lib:format("~p", [A])];
-format_args1([A|As]) ->
- [io_lib:format("~p", [A]),$,|format_args1(As)];
-format_args1([]) ->
+format_args1([A], P) ->
+ [io_lib:format(P, [A])];
+format_args1([A|As], P) ->
+ [io_lib:format(P, [A]),$,|format_args1(As, P)];
+format_args1([], _) ->
[].
%%--Other useful functions--------------------------------------------
@@ -1248,7 +1251,7 @@ if_clauses([], Bs, Ieval) ->
exception(error, if_clause, Bs, Ieval).
%% case_clauses(Value, Clauses, Bindings, Error, Ieval)
-%% Error = try_clause � case_clause
+%% Error = try_clause | case_clause
case_clauses(Val, [{clause,_,[P],G,B}|Cs], Bs0, Error, Ieval) ->
case match(P, Val, Bs0) of
{match,Bs} ->