diff options
author | Hans Bolinder <[email protected]> | 2013-02-22 15:09:25 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2013-03-07 13:54:33 +0100 |
commit | d0bb666c8811615981db8721c119ee6450857272 (patch) | |
tree | 8d9f67dfe26e61ff9a69e9a7f86eb302e1f1d7ab /lib/debugger/src/dbg_ieval.erl | |
parent | a8c7417e2e1b6e20c1f1a7247a04579b77ce9037 (diff) | |
download | otp-d0bb666c8811615981db8721c119ee6450857272.tar.gz otp-d0bb666c8811615981db8721c119ee6450857272.tar.bz2 otp-d0bb666c8811615981db8721c119ee6450857272.zip |
[debugger] Add an option 'Strings'
A new checkbox has been added. When it is checked, the range set by
the 'erl' flag '+pc' is used for determining when to print lists of
integers as strings. When it is unchecked, integer lists are never
printed as strings.
A minor incompatibility: settings saved by Erlang R16B01
or later cannot be read by Erlang R16B or earlier.
Diffstat (limited to 'lib/debugger/src/dbg_ieval.erl')
-rw-r--r-- | lib/debugger/src/dbg_ieval.erl | 105 |
1 files changed, 54 insertions, 51 deletions
diff --git a/lib/debugger/src/dbg_ieval.erl b/lib/debugger/src/dbg_ieval.erl index f5744a6e14..f4b6d488a5 100644 --- a/lib/debugger/src/dbg_ieval.erl +++ b/lib/debugger/src/dbg_ieval.erl @@ -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~ts~n", - [Le,Li,M,F,format_args(As)]); - local -> - io_lib:format("++ (~w) <~w> ~w~ts~n", - [Le,Li,F,format_args(As)]) - end; - call_fun -> - {Le,Li,F,As} = Args, - io_lib:format("++ (~w) <~w> ~w~ts~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~ts~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-------------------------------------------- |