From c7a03db603434507108413605d6701758d3842c1 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 10 Jan 2013 16:05:56 +0100 Subject: debugger: Fix user evalution dependent of bindings in trace window Bindings in erl_eval is an orddict and must be sorted otherwise they are not found, depending on creation order --- lib/debugger/src/dbg_debugged.erl | 5 +++-- lib/debugger/src/dbg_ieval.erl | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/debugger/src/dbg_debugged.erl b/lib/debugger/src/dbg_debugged.erl index 4d9ffc4f3b..c21ad486e8 100644 --- a/lib/debugger/src/dbg_debugged.erl +++ b/lib/debugger/src/dbg_debugged.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 @@ -104,7 +104,8 @@ handle_command(Command) -> reply({apply,M,F,As}) -> {value, erlang:apply(M,F,As)}; reply({eval,Expr,Bs}) -> - erl_eval:expr(Expr, Bs). % {value, Value, Bs2} + %% Bindings is an orddict (sort them) + erl_eval:expr(Expr, lists:sort(Bs)). % {value, Value, Bs2} %% Demonitor and delete message from inbox %% diff --git a/lib/debugger/src/dbg_ieval.erl b/lib/debugger/src/dbg_ieval.erl index 5e5948c965..3c084c53ac 100644 --- a/lib/debugger/src/dbg_ieval.erl +++ b/lib/debugger/src/dbg_ieval.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2012. 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 -- cgit v1.2.3 From 81923b068139ddfd0b960a55506fcad834102147 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Fri, 11 Jan 2013 09:54:57 +0100 Subject: debugger: Remove bad gs:call A present non working gs call was left in the code --- lib/debugger/src/dbg_wx_trace_win.erl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/debugger/src/dbg_wx_trace_win.erl b/lib/debugger/src/dbg_wx_trace_win.erl index 40d110f071..ffe7401904 100644 --- a/lib/debugger/src/dbg_wx_trace_win.erl +++ b/lib/debugger/src/dbg_wx_trace_win.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -19,7 +19,6 @@ %% -module(dbg_wx_trace_win). --compile([{nowarn_deprecated_function,{gs,config,2}}]). %% External exports -export([init/0, stop/1]). @@ -481,13 +480,9 @@ display(#winInfo{window=Win, sb=Sb},Arg) -> %% Contents = string() %% Note: remove_code/2 should not be used for currently shown module. %%-------------------------------------------------------------------- -is_shown(WinInfo, Mod) -> - case lists:keyfind(Mod, 1, WinInfo#winInfo.editors) of - {Mod, Editor} -> - gs:config(Editor, raise), %% BUGBUG - {true, WinInfo#winInfo{editor={Mod, Editor}}}; - false -> false - end. +is_shown(_WinInfo, _Mod) -> + %% Previously cached modules here, nyi so return false + false. show_code(WinInfo = #winInfo{editor={_, Ed}}, Mod, Contents) -> %% Insert code and update breakpoints, if any -- cgit v1.2.3 From 2ca0bdc7ebcef76be2ec466ed5c517eb955b0d65 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Fri, 11 Jan 2013 09:56:49 +0100 Subject: debugger: Fix code viewing on wxWidgets-2.9 wxWidgets contains more code format options and if they are not set it looks really bad. --- lib/debugger/src/dbg_wx_code.erl | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/lib/debugger/src/dbg_wx_code.erl b/lib/debugger/src/dbg_wx_code.erl index 99826d9bdb..9853a5dbae 100644 --- a/lib/debugger/src/dbg_wx_code.erl +++ b/lib/debugger/src/dbg_wx_code.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -30,6 +30,21 @@ -define(stc, wxStyledTextCtrl). +%% For wx-2.9 usage +-ifndef(wxSTC_ERLANG_COMMENT_FUNCTION). +-define(wxSTC_ERLANG_COMMENT_FUNCTION, 14). +-define(wxSTC_ERLANG_COMMENT_MODULE, 15). +-define(wxSTC_ERLANG_COMMENT_DOC, 16). +-define(wxSTC_ERLANG_COMMENT_DOC_MACRO, 17). +-define(wxSTC_ERLANG_ATOM_QUOTED, 18). +-define(wxSTC_ERLANG_MACRO_QUOTED, 19). +-define(wxSTC_ERLANG_RECORD_QUOTED, 20). +-define(wxSTC_ERLANG_NODE_NAME_QUOTED, 21). +-define(wxSTC_ERLANG_BIFS, 22). +-define(wxSTC_ERLANG_MODULES, 23). +-define(wxSTC_ERLANG_MODULES_ATT, 24). +-endif. + code_area(Parent) -> FixedFont = wxFont:new(10, ?wxFONTFAMILY_TELETYPE, ?wxNORMAL, ?wxNORMAL,[]), %%Ed = wxStyledTextCtrl:new(Parent, [{size, {700, 500}}]), @@ -58,7 +73,21 @@ code_area(Parent) -> {?wxSTC_ERLANG_MACRO, {40,144,170}}, {?wxSTC_ERLANG_RECORD, {40,100,20}}, {?wxSTC_ERLANG_SEPARATOR,{0,0,0}}, - {?wxSTC_ERLANG_NODE_NAME,{0,0,0}}], + {?wxSTC_ERLANG_NODE_NAME,{0,0,0}}, + %% Optional 2.9 stuff + {?wxSTC_ERLANG_COMMENT_FUNCTION, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_MODULE, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_DOC, {160,53,35}}, + {?wxSTC_ERLANG_COMMENT_DOC_MACRO, {160,53,35}}, + {?wxSTC_ERLANG_ATOM_QUOTED, {0,0,0}}, + {?wxSTC_ERLANG_MACRO_QUOTED, {40,144,170}}, + {?wxSTC_ERLANG_RECORD_QUOTED, {40,100,20}}, + {?wxSTC_ERLANG_NODE_NAME_QUOTED, {0,0,0}}, + {?wxSTC_ERLANG_BIFS, {130,40,172}}, + {?wxSTC_ERLANG_MODULES, {64,102,244}}, + {?wxSTC_ERLANG_MODULES_ATT, {64,102,244}} + ], + SetStyle = fun({Style, Color}) -> ?stc:styleSetFont(Ed, Style, FixedFont), ?stc:styleSetForeground(Ed, Style, Color) -- cgit v1.2.3 From 7f048c5d71534d458351513e84bb879c47f2c76e Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Fri, 11 Jan 2013 11:07:25 +0100 Subject: debugger: View terms as unicode-strings Changed the displayed variables to be printed with ~tp to show default all lists and utf-8 binaries as unicode strings. If the user want to see the content without unicode strings he can click on them to see the content as integers, if not it only contains latin1 because ~p converts that. There is currently no way to display it as lists with indentation, so I choose to keep it as it was. --- lib/debugger/src/dbg_wx_trace.erl | 4 ++-- lib/debugger/src/dbg_wx_trace_win.erl | 2 +- lib/debugger/src/dbg_wx_win.erl | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/debugger/src/dbg_wx_trace.erl b/lib/debugger/src/dbg_wx_trace.erl index f61df93aec..0a3cac905f 100644 --- a/lib/debugger/src/dbg_wx_trace.erl +++ b/lib/debugger/src/dbg_wx_trace.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -513,7 +513,7 @@ gui_cmd({edit, {Var, Val}}, State) -> cancel -> State; {Var, Term} -> - Cmd = atom_to_list(Var)++"="++io_lib:format("~p", [Term]), + Cmd = atom_to_list(Var)++"="++io_lib:format("~w", [Term]), gui_cmd({user_command, lists:flatten(Cmd)}, State) end. diff --git a/lib/debugger/src/dbg_wx_trace_win.erl b/lib/debugger/src/dbg_wx_trace_win.erl index ffe7401904..8b206ccd78 100644 --- a/lib/debugger/src/dbg_wx_trace_win.erl +++ b/lib/debugger/src/dbg_wx_trace_win.erl @@ -567,7 +567,7 @@ update_bindings(#winInfo{bind=#sub{out=BA}}, Bs) -> wx:foldl(fun({Var,Val},Row) -> wxListCtrl:insertItem(BA, Row, ""), wxListCtrl:setItem(BA, Row, 0, dbg_wx_win:to_string(Var)), - wxListCtrl:setItem(BA, Row, 1, dbg_wx_win:to_string("~500P",[Val, 80])), + wxListCtrl:setItem(BA, Row, 1, dbg_wx_win:to_string("~99999tP",[Val, 20])), Row+1 end, 0, Bs), put(bindings,Bs), diff --git a/lib/debugger/src/dbg_wx_win.erl b/lib/debugger/src/dbg_wx_win.erl index faf3cc178f..3cb6edd953 100644 --- a/lib/debugger/src/dbg_wx_win.erl +++ b/lib/debugger/src/dbg_wx_win.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -252,9 +252,9 @@ notify(Win,Message) -> %%-------------------------------------------------------------------- entry(Parent, Title, Prompt, {Type, Value}) -> - Ted = wxTextEntryDialog:new(Parent, to_string(Prompt), - [{caption, to_string(Title)}, - {value, to_string(Value)}]), + Ted = wxTextEntryDialog:new(Parent, to_string(Prompt), + [{caption, to_string(Title)}, + {value, to_string("~999999tp",Value)}]), case wxDialog:showModal(Ted) of ?wxID_OK -> @@ -306,7 +306,7 @@ to_string([]) -> ""; to_string(List) when is_list(List) -> List; to_string(Term) -> - io_lib:format("~p",[Term]). + io_lib:format("~tp",[Term]). to_string(Format,Args) -> io_lib:format(Format, Args). -- cgit v1.2.3