From 7eaaf5dd6140eda8b3892ef23e1fcf70be90d7c4 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Fri, 16 Jun 2017 16:26:06 +0200 Subject: debugger: Improve handling of Unicode --- lib/debugger/src/dbg_wx_trace.erl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'lib/debugger/src/dbg_wx_trace.erl') diff --git a/lib/debugger/src/dbg_wx_trace.erl b/lib/debugger/src/dbg_wx_trace.erl index f4ee30618c..b1e0e03b4c 100644 --- a/lib/debugger/src/dbg_wx_trace.erl +++ b/lib/debugger/src/dbg_wx_trace.erl @@ -345,11 +345,12 @@ gui_cmd('Back Trace', State) -> P = p(State), lists:foreach( fun({Le, {Mod,Func,Args}}) -> - Str = io_lib:format("~p > ~p:~p"++P++"~n", - [Le, Mod, Func, Args]), + Str = io_lib:format("~p > ~w:~tw~ts\n", + [Le, Mod, Func, format_args(Args, P)]), dbg_wx_trace_win:trace_output(State#state.win,Str); ({Le, {Fun,Args}}) -> - Str = io_lib:format("~p > ~p"++P++"~n", [Le, Fun, Args]), + Str = io_lib:format("~p > ~p~ts~n", + [Le, Fun, format_args(Args, P)]), dbg_wx_trace_win:trace_output(State#state.win,Str); (_) -> ignore end, @@ -539,6 +540,18 @@ add_break(WI, Coords, Type, Mod, Line) -> Win = dbg_wx_trace_win:get_window(WI), dbg_wx_break:start(Win, Coords, Type, Mod, Line). +format_args(As, P) when is_list(As) -> + [$(,format_args1(As, P),$)]; +format_args(A, P) -> + [$/,io_lib:format(P, [A])]. + +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([], _) -> + []. + %%--Commands from the interpreter------------------------------------- int_cmd({interpret, Mod}, State) -> -- cgit v1.2.3