diff options
Diffstat (limited to 'lib/debugger')
-rw-r--r-- | lib/debugger/doc/src/notes.xml | 42 | ||||
-rw-r--r-- | lib/debugger/src/Makefile | 8 | ||||
-rw-r--r-- | lib/debugger/src/dbg_debugged.erl | 5 | ||||
-rw-r--r-- | lib/debugger/src/dbg_ieval.erl | 14 | ||||
-rw-r--r-- | lib/debugger/src/dbg_ui_trace.erl | 14 | ||||
-rw-r--r-- | lib/debugger/src/dbg_ui_trace_win.erl | 4 | ||||
-rw-r--r-- | lib/debugger/src/dbg_wx_code.erl | 33 | ||||
-rw-r--r-- | lib/debugger/src/dbg_wx_filedialog_win.erl | 9 | ||||
-rw-r--r-- | lib/debugger/src/dbg_wx_settings.erl | 50 | ||||
-rw-r--r-- | lib/debugger/src/dbg_wx_trace.erl | 16 | ||||
-rw-r--r-- | lib/debugger/src/dbg_wx_trace_win.erl | 19 | ||||
-rw-r--r-- | lib/debugger/src/dbg_wx_win.erl | 10 | ||||
-rw-r--r-- | lib/debugger/src/i.erl | 4 | ||||
-rw-r--r-- | lib/debugger/src/int.erl | 93 | ||||
-rw-r--r-- | lib/debugger/test/erl_eval_SUITE.erl | 36 | ||||
-rw-r--r-- | lib/debugger/test/int_eval_SUITE_data/my_int_eval_module.erl | 8 | ||||
-rw-r--r-- | lib/debugger/vsn.mk | 2 |
17 files changed, 212 insertions, 155 deletions
diff --git a/lib/debugger/doc/src/notes.xml b/lib/debugger/doc/src/notes.xml index 66638a59f6..d38d51075f 100644 --- a/lib/debugger/doc/src/notes.xml +++ b/lib/debugger/doc/src/notes.xml @@ -32,6 +32,48 @@ <p>This document describes the changes made to the Debugger application.</p> +<section><title>Debugger 3.2.9</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Fix Debugger settings dialog due to changed behavior in + wxFileDialog (Thanks to H�kan Mattsson)</p> + <p> + Own Id: OTP-10621</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> Support for Unicode has been implemented. </p> + <p> + Own Id: OTP-10302</p> + </item> + <item> + <p>Where necessary a comment stating encoding has been + added to Erlang files. The comment is meant to be removed + in Erlang/OTP R17B when UTF-8 becomes the default + encoding. </p> + <p> + Own Id: OTP-10630</p> + </item> + <item> + <p> + Integer lists and utf-8 binaries in variables are now + displayed as strings.</p> + <p> + Own Id: OTP-10679</p> + </item> + </list> + </section> + +</section> + <section><title>Debugger 3.2.8</title> <section><title>Fixed Bugs and Malfunctions</title> diff --git a/lib/debugger/src/Makefile b/lib/debugger/src/Makefile index e8b350c0c7..85754da219 100644 --- a/lib/debugger/src/Makefile +++ b/lib/debugger/src/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2012. All Rights Reserved. +# Copyright Ericsson AB 1997-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 @@ -98,7 +98,7 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += +warn_obsolete_guard +ERL_COMPILE_FLAGS += +warn_obsolete_guard -Werror # ---------------------------------------------------- @@ -112,10 +112,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: 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 2e88c35741..f5744a6e14 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 @@ -345,15 +345,15 @@ trace(What, Args, true) -> {Called, {Le,Li,M,F,As}} = Args, case Called of extern -> - io_lib:format("++ (~w) <~w> ~w:~w~s~n", + io_lib:format("++ (~w) <~w> ~w:~w~ts~n", [Le,Li,M,F,format_args(As)]); local -> - io_lib:format("++ (~w) <~w> ~w~s~n", + 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~s~n", + io_lib:format("++ (~w) <~w> ~w~ts~n", [Le, Li, F, format_args(As)]); return -> {Le,Val} = Args, @@ -362,7 +362,7 @@ trace(What, Args, true) -> bif -> {Le,Li,M,F,As} = Args, - io_lib:format("++ (~w) <~w> ~w:~w~s~n", + io_lib:format("++ (~w) <~w> ~w:~w~ts~n", [Le, Li, M, F, format_args(As)]) end, dbg_icmd:tell_attached({trace_output, Str}); @@ -1248,7 +1248,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} -> diff --git a/lib/debugger/src/dbg_ui_trace.erl b/lib/debugger/src/dbg_ui_trace.erl index d318987f60..3e1fb2dcae 100644 --- a/lib/debugger/src/dbg_ui_trace.erl +++ b/lib/debugger/src/dbg_ui_trace.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. 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 @@ -31,10 +31,10 @@ pid, % pid() Debugged process meta, % pid() Meta process - status, % {Status,Mod,Line} � {exit,Where,Reason} - % Status = init � idle | break - % | wait_break � wait_running - % � running + status, % {Status,Mod,Line} | {exit,Where,Reason} + % Status = init | idle | break + % | wait_break | wait_running + % | running % Where={Mod,Line} | null cm, % atom() | undefined Current module @@ -321,7 +321,7 @@ gui_cmd('Messages', State) -> fun(Msg, N) -> Str1 = io_lib:format(" ~w:", [N]), dbg_ui_trace_win:eval_output(Str1, bold), - Str2 = io_lib:format(" ~s~n",[io_lib:print(Msg)]), + Str2 = io_lib:format(" ~ts~n",[io_lib:print(Msg)]), dbg_ui_trace_win:eval_output(Str2, normal), N+1 end, @@ -718,7 +718,7 @@ menus() -> %% enable(Status) -> [MenuItem] %% Status = init % when first message from Meta has arrived -%% | idle | break | exit | wait_break � wait_running | running +%% | idle | break | exit | wait_break | wait_running | running enable(init) -> []; enable(idle) -> ['Stop','Kill']; enable(break) -> ['Step','Next','Continue','Finish','Skip', diff --git a/lib/debugger/src/dbg_ui_trace_win.erl b/lib/debugger/src/dbg_ui_trace_win.erl index 1b439cbf18..beb3fbd71e 100644 --- a/lib/debugger/src/dbg_ui_trace_win.erl +++ b/lib/debugger/src/dbg_ui_trace_win.erl @@ -418,8 +418,8 @@ clear_breaks(WinInfo, Mod) -> %%-------------------------------------------------------------------- %% display(Arg) %% Arg = idle | {Status,Mod,Line} | {running,Mod} -%% � {exit,Where,Reason} | {text,Text} -%% Status = break | wait � Level +%% | {exit,Where,Reason} | {text,Text} +%% Status = break | wait | Level %% Level = int() %% Mod = atom() %% Line = integer() 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) diff --git a/lib/debugger/src/dbg_wx_filedialog_win.erl b/lib/debugger/src/dbg_wx_filedialog_win.erl index f109652a70..c8ecb7b5d4 100644 --- a/lib/debugger/src/dbg_wx_filedialog_win.erl +++ b/lib/debugger/src/dbg_wx_filedialog_win.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2012. 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 @@ -381,7 +381,6 @@ show_completion(Wanted, State = #state{text=TC, win=Win, list=LC, completion=Com Last = wxTextCtrl:getLastPosition(TC), wxTextCtrl:setSelection(TC, Start, Last), destroy_completion(Comp), - wxWindow:setFocus(TC), State#state{ptext=Path, completion=undefined}; Paths when Comp =:= undefined -> {PosX,PosY} = wxListCtrl:getPosition(LC), @@ -406,14 +405,16 @@ show_completion(Wanted, State = #state{text=TC, win=Win, list=LC, completion=Com %% wxListBox:connect(LB, command_listbox_doubleclicked), wxListBox:connect(LB, command_listbox_selected), wxWindow:show(Temp), + %% setFocus does a select all on 2.9 sigh.. + {Start, Last} = wxTextCtrl:getSelection(TC), wxWindow:setFocus(TC), + wxTextCtrl:setSelection(TC, Start, Last), State#state{completion = {Temp, LB}, ptext=Wanted}; Paths -> {_Temp, LB} = Comp, wxListBox:clear(LB), Files = [filename:basename(File) || File <- Paths], - wxListBox:insertItems(LB,Files,0), - wxWindow:setFocus(TC), + Files /= [] andalso wxListBox:insertItems(LB,Files,0), State#state{ptext=Wanted} end. diff --git a/lib/debugger/src/dbg_wx_settings.erl b/lib/debugger/src/dbg_wx_settings.erl index 3be93c495c..20aac74c3d 100644 --- a/lib/debugger/src/dbg_wx_settings.erl +++ b/lib/debugger/src/dbg_wx_settings.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2011. 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 @@ -49,31 +49,35 @@ save(Win, Pos, SFile) -> open_win(Win, Pos, SFile, Str, What) -> {SDir, SFileName} = - if - %% If settings are saved for the first time, and to - %% the default directory HOME/erlang.tools/debugger, - %% make sure the directory exists, or create it if - %% desired and possible - SFile==default -> {default_settings_dir(Win), "NoName.state"}; - true -> {filename:dirname(SFile), filename:basename(SFile)} - end, - + if + %% If settings are saved for the first time, and to + %% the default directory HOME/erlang.tools/debugger, + %% make sure the directory exists, or create it if + %% desired and possible + SFile==default -> {default_settings_dir(Win), "NoName.state"}; + true -> {filename:dirname(SFile), filename:basename(SFile)} + end, + FD = wxFileDialog:new(Win, [{message,Str},{pos, Pos}, - {defaultDir,SDir}, - {defaultFile,SFileName}, - {wildCard, "*.state"}, - {style,What}]), + {defaultDir,SDir}, + {defaultFile,SFileName}, + {wildCard, "*.state"}, + {style,What}]), case wxFileDialog:showModal(FD) of - ?wxID_OK -> - File = wxFileDialog:getFilename(FD), - Dir = wxFileDialog:getDirectory(FD), - wxFileDialog:destroy(FD), - {ok, filename:join(Dir,File)}; - _ -> - wxFileDialog:destroy(FD), - cancel + ?wxID_OK -> + case wxFileDialog:getPaths(FD) of + [NewFile] -> + wxFileDialog:destroy(FD), + {ok, NewFile}; + _ -> + wxFileDialog:destroy(FD), + cancel + end; + _ -> + wxFileDialog:destroy(FD), + cancel end. - + default_settings_dir(Win) -> {ok, [[Home]]} = init:get_argument(home), DefDir = filename:join([Home, ".erlang_tools", "debugger"]), diff --git a/lib/debugger/src/dbg_wx_trace.erl b/lib/debugger/src/dbg_wx_trace.erl index 2fdf39ba5a..bd92cb4b42 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-2011. 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 @@ -32,10 +32,10 @@ pid, % pid() Debugged process meta, % pid() Meta process - status, % {Status,Mod,Line} � {exit,Where,Reason} - % Status = init � idle | break - % | wait_break � wait_running - % � running + status, % {Status,Mod,Line} | {exit,Where,Reason} + % Status = init | idle | break + % | wait_break | wait_running + % | running % Where={Mod,Line} | null cm, % atom() | undefined Current module @@ -331,7 +331,7 @@ gui_cmd('Messages', State) -> fun(Msg, N) -> Str1 = io_lib:format(" ~w:", [N]), dbg_wx_trace_win:eval_output(State#state.win,Str1, bold), - Str2 = io_lib:format(" ~s~n",[io_lib:print(Msg)]), + Str2 = io_lib:format(" ~ts~n",[io_lib:print(Msg)]), dbg_wx_trace_win:eval_output(State#state.win,Str2, normal), N+1 end, @@ -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. @@ -740,7 +740,7 @@ menus() -> %% enable(Status) -> [MenuItem] %% Status = init % when first message from Meta has arrived -%% | idle | break | exit | wait_break � wait_running | running +%% | idle | break | exit | wait_break | wait_running | running enable(init) -> []; enable(idle) -> ['Stop','Kill']; enable(break) -> ['Step','Next','Continue','Finish','Skip', diff --git a/lib/debugger/src/dbg_wx_trace_win.erl b/lib/debugger/src/dbg_wx_trace_win.erl index 68e8e0b844..8b206ccd78 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]). @@ -431,8 +430,8 @@ clear_breaks(WinInfo, Mod) -> %%-------------------------------------------------------------------- %% display(Arg) %% Arg = idle | {Status,Mod,Line} | {running,Mod} -%% � {exit,Where,Reason} | {text,Text} -%% Status = break | wait � Level +%% | {exit,Where,Reason} | {text,Text} +%% Status = break | wait | Level %% Level = int() %% Mod = atom() %% Line = integer() @@ -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 @@ -572,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). diff --git a/lib/debugger/src/i.erl b/lib/debugger/src/i.erl index 4d0b862196..5805501524 100644 --- a/lib/debugger/src/i.erl +++ b/lib/debugger/src/i.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 @@ -197,7 +197,7 @@ get_file(Mod) -> end. ilformat(A1, A2) -> - format("~-20s ~s\n", [A1,A2]). + format("~-20s ~ts\n", [A1,A2]). %% ------------------------------------------- %% Print all break points in modules. diff --git a/lib/debugger/src/int.erl b/lib/debugger/src/int.erl index b3a8a07f03..bdd671cff1 100644 --- a/lib/debugger/src/int.erl +++ b/lib/debugger/src/int.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 @@ -517,7 +517,7 @@ int_mod(AbsMod, Dist) when is_atom(AbsMod); is_list(AbsMod) -> [App, AbsMod]), error; _Error -> - io:format("** Invalid beam file or no abstract code: ~p\n", + io:format("** Invalid beam file or no abstract code: ~tp\n", [AbsMod]), error end. @@ -626,18 +626,18 @@ find_src(Beam) -> find_beam(Mod, Src) -> SrcDir = filename:dirname(Src), - BeamFile = packages:last(Mod) ++ code:objfile_extension(), + BeamFile = atom_to_list(Mod) ++ code:objfile_extension(), File = filename:join(SrcDir, BeamFile), case is_file(File) of true -> File; - false -> find_beam_1(Mod, SrcDir) + false -> find_beam_1(Mod, BeamFile, SrcDir) end. -find_beam_1(Mod, SrcDir) -> - RootDir = find_root_dir(SrcDir, packages:first(Mod)), +find_beam_1(Mod, BeamFile, SrcDir) -> + RootDir = filename:dirname(SrcDir), EbinDir = filename:join(RootDir, "ebin"), CodePath = [EbinDir | code:get_path()], - BeamFile = to_path(Mod) ++ code:objfile_extension(), + BeamFile = atom_to_list(Mod) ++ code:objfile_extension(), lists:foldl(fun(_, Beam) when is_list(Beam) -> Beam; (Dir, error) -> File = filename:join(Dir, BeamFile), @@ -649,14 +649,6 @@ find_beam_1(Mod, SrcDir) -> error, CodePath). -to_path(X) -> - filename:join(packages:split(X)). - -find_root_dir(Dir, [_|Ss]) -> - find_root_dir(filename:dirname(Dir), Ss); -find_root_dir(Dir, []) -> - filename:dirname(Dir). - check_beam(BeamBin) when is_binary(BeamBin) -> case beam_lib:chunks(BeamBin, [abstract_code,exports]) of {ok,{_Mod,[{abstract_code,no_abstract_code}|_]}} -> @@ -682,43 +674,52 @@ everywhere(local, Fun) -> Fun(). scan_module_name(File) -> - case erl_prim_loader:get_file(filename:absname(File)) of - {ok, Bin, _FullPath} -> - Chars = binary_to_list(Bin), - R = (catch {ok, scan_module_name_1(Chars)}), - case R of - {ok, A} when is_atom(A) -> A; - _ -> error - end; - _ -> - error + try + {ok, Bin, _FullPath} = + erl_prim_loader:get_file(filename:absname(File)), + scan_module_name_1([], <<>>, Bin, enc(Bin)) + catch + _:_ -> + throw({error, no_beam}) end. -scan_module_name_1(Chars) -> - case erl_scan:tokens("", Chars, 1) of - {done, {ok, Ts, _}, Rest} -> - scan_module_name_2(Ts, Rest); - _ -> - error +scan_module_name_1(Cont0, B0, Bin0, Enc) -> + N = min(100, byte_size(Bin0)), + {Bin1, Bin} = erlang:split_binary(Bin0, N), + {Chars, B1} = + case unicode:characters_to_list(list_to_binary([B0, Bin1]), Enc) of + {incomplete, List, Binary} -> + {List, Binary}; + List when is_list(List), List =/= [] -> + {List, <<>>} + end, + scan_module_name_2(Cont0, Chars, B1, Bin, Enc). + +scan_module_name_2(Cont0, Chars, B1, Bin, Enc) -> + case erl_scan:tokens(Cont0, Chars, _AnyLine = 1) of + {done, {ok, Ts, _}, Rest} -> + scan_module_name_3(Ts, Rest, B1, Bin, Enc); + {more, Cont} -> + scan_module_name_1(Cont, B1, Bin, Enc) end. -scan_module_name_2([{'-',_},{atom,_,module},{'(',_} | _]=Ts, _Chars) -> - scan_module_name_3(Ts); -scan_module_name_2([{'-',_},{atom,_,_} | _], Chars) -> - scan_module_name_1(Chars); -scan_module_name_2(_, _) -> - error. - -scan_module_name_3(Ts) -> - case erl_parse:parse_form(Ts) of - {ok, {attribute,_,module,{M,_}}} -> module_atom(M); - {ok, {attribute,_,module,M}} -> module_atom(M); - _ -> error +scan_module_name_3([{'-',_},{atom,_,module},{'(',_} | _]=Ts, + _Chars, _B1, _Bin, _Enc) -> + scan_module_name_4(Ts); +scan_module_name_3([{'-',_},{atom,_,_} | _], Chars, B1, Bin, Enc) -> + scan_module_name_2("", Chars, B1, Bin, Enc). + +scan_module_name_4(Ts) -> + {ok, {attribute,_,module,M}} = erl_parse:parse_form(Ts), + true = is_atom(M), + M. + +enc(Bin) -> + case epp:read_encoding_from_binary(Bin) of + none -> epp:default_encoding(); + Encoding -> Encoding end. -module_atom(A) when is_atom(A) -> A; -module_atom(L) when is_list(L) -> list_to_atom(packages:concat(L)). - %%--Stop interpreting modules----------------------------------------- del_mod(AbsMod, Dist) -> diff --git a/lib/debugger/test/erl_eval_SUITE.erl b/lib/debugger/test/erl_eval_SUITE.erl index a92251e1af..bb2669f450 100644 --- a/lib/debugger/test/erl_eval_SUITE.erl +++ b/lib/debugger/test/erl_eval_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2011. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -216,13 +216,13 @@ guard_4(doc) -> guard_4(suite) -> []; guard_4(Config) when is_list(Config) -> - ?line check(fun() -> if {erlang,'+'}(3,a) -> true ; true -> false end end, - "if {erlang,'+'}(3,a) -> true ; true -> false end.", - false), - ?line check(fun() -> if {erlang,is_integer}(3) -> true ; true -> false end - end, - "if {erlang,is_integer}(3) -> true ; true -> false end.", - true), + check(fun() -> if erlang:'+'(3,a) -> true ; true -> false end end, + "if erlang:'+'(3,a) -> true ; true -> false end.", + false), + check(fun() -> if erlang:is_integer(3) -> true ; true -> false end + end, + "if erlang:is_integer(3) -> true ; true -> false end.", + true), ?line check(fun() -> [X || X <- [1,2,3], erlang:is_integer(X)] end, "[X || X <- [1,2,3], erlang:is_integer(X)].", [1,2,3]), @@ -230,11 +230,11 @@ guard_4(Config) when is_list(Config) -> end, "if is_atom(is_integer(a)) -> true ; true -> false end.", true), - ?line check(fun() -> if {erlang,is_atom}({erlang,is_integer}(a)) -> true; - true -> false end end, - "if {erlang,is_atom}({erlang,is_integer}(a)) -> true; " - "true -> false end.", - true), + check(fun() -> if erlang:is_atom(erlang:is_integer(a)) -> true; + true -> false end end, + "if erlang:is_atom(erlang:is_integer(a)) -> true; " + "true -> false end.", + true), ?line check(fun() -> if is_atom(3+a) -> true ; true -> false end end, "if is_atom(3+a) -> true ; true -> false end.", false), @@ -1060,11 +1060,6 @@ do_funs(LFH, EFH) -> concat(["begin F1 = fun(F,N) -> apply(", M, ",count_down,[F, N]) end, F1(F1,1000) end."]), 0, ['F1'], LFH, EFH), - ?line check(fun() -> F1 = fun(F,N) -> {?MODULE,count_down}(F,N) - end, F1(F1, 1000) end, - concat(["begin F1 = fun(F,N) -> {", M, - ",count_down}(F, N) end, F1(F1,1000) end."]), - 0, ['F1'], LFH, EFH), ?line check(fun() -> F = fun(F,N) when N > 0 -> apply(F,[F,N-1]); (_F,0) -> ok end, F(F, 1000) @@ -1096,11 +1091,6 @@ do_funs(LFH, EFH) -> true = {2,3} == F(2) end, "begin F = fun(X) -> A = 1+X, {X,A} end, true = {2,3} == F(2) end.", true, ['F'], LFH, EFH), - ?line check(fun() -> F = fun(X) -> {erlang,'+'}(X,2) end, - true = 3 == F(1) end, - "begin F = fun(X) -> {erlang,'+'}(X,2) end," - " true = 3 == F(1) end.", true, ['F'], - LFH, EFH), ?line check(fun() -> F = fun(X) -> byte_size(X) end, ?MODULE:do_apply(F,<<"hej">>) end, concat(["begin F = fun(X) -> size(X) end,", diff --git a/lib/debugger/test/int_eval_SUITE_data/my_int_eval_module.erl b/lib/debugger/test/int_eval_SUITE_data/my_int_eval_module.erl index c9ac6931e2..c5c6a56363 100644 --- a/lib/debugger/test/int_eval_SUITE_data/my_int_eval_module.erl +++ b/lib/debugger/test/int_eval_SUITE_data/my_int_eval_module.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2011. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -76,12 +76,6 @@ apply_test(Fun) -> [a,b,d] = ?MODULE:Func(same([a,b,c,d]), same([c])), [d,e] = apply(Mod, Func, [same([d,e,f]), same([f])]), [3] = apply(?MODULE, Func, [same([3,4]),same([4])]), - - %% This is obsolete, but it should work anyway. - HomeMadeFun = {?MODULE,my_subtract}, - [a] = HomeMadeFun(same([a,x,c]), same([x,c])), - [x] = apply(HomeMadeFun, [[x,y],[y,z]]), - ok. number(X) -> {number,X}. diff --git a/lib/debugger/vsn.mk b/lib/debugger/vsn.mk index 5b572f5f20..b22b379cab 100644 --- a/lib/debugger/vsn.mk +++ b/lib/debugger/vsn.mk @@ -1 +1 @@ -DEBUGGER_VSN = 3.2.8 +DEBUGGER_VSN = 3.2.9 |