Skip to content

Commit

Permalink
Merge branch 'dgud/observer/bug-fixes/OTP-10075' into maint
Browse files Browse the repository at this point in the history
* dgud/observer/bug-fixes/OTP-10075:
  [observer] Fix dialyser warnings
  Format latin binary strings in table viewer
  Fix process_info from app tab on other nodes
  • Loading branch information
dgud committed Aug 21, 2012
2 parents 5c840fa + 3af8c55 commit 8a165db
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 22 deletions.
10 changes: 8 additions & 2 deletions lib/observer/src/observer_app_wx.erl
Expand Up @@ -267,9 +267,15 @@ handle_call(Event, From, _State) ->
handle_cast(Event, _State) ->
error({unhandled_cast, Event}).
%%%%%%%%%%
handle_info({active, Node}, State = #state{parent=Parent, current=Curr}) ->
handle_info({active, Node}, State = #state{parent=Parent, current=Curr, appmon=Appmon}) ->
create_menus(Parent, []),
{ok, Pid} = appmon_info:start_link(Node, self(), []),
Pid = try
Node = node(Appmon),
Appmon
catch _:_ ->
{ok, P} = appmon_info:start_link(Node, self(), []),
P
end,
appmon_info:app_ctrl(Pid, Node, true, []),
(Curr =/= undefined) andalso appmon_info:app(Pid, Curr, true, []),
{noreply, State#state{appmon=Pid}};
Expand Down
2 changes: 1 addition & 1 deletion lib/observer/src/observer_perf_wx.erl
Expand Up @@ -123,7 +123,7 @@ init([Notebook, Parent]) ->
}}
catch _:Err ->
io:format("~p crashed ~p: ~p~n",[?MODULE, Err, erlang:get_stacktrace()]),
{error, Err}
{stop, Err}
end.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
3 changes: 1 addition & 2 deletions lib/observer/src/observer_pro_wx.erl
Expand Up @@ -258,8 +258,7 @@ terminate(_Reason, #state{holder=Holder}) ->
ok.

code_change(_, _, State) ->
{stop, not_yet_implemented, State}.

{ok, State}.

handle_call(Msg, _From, State) ->
io:format("~p:~p: Unhandled call ~p~n",[?MODULE, ?LINE, Msg]),
Expand Down
10 changes: 4 additions & 6 deletions lib/observer/src/observer_procinfo.erl
Expand Up @@ -127,17 +127,15 @@ terminate(_Reason, #state{parent=Parent,pid=Pid,frame=Frame}) ->
ok.

code_change(_, _, State) ->
{stop, not_yet_implemented, State}.
{ok, State}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
init_process_page(Panel, Pid) ->
Fields0 = process_info_fields(Pid),
{FPanel, _, UpFields} = observer_lib:display_info(Panel, Fields0),
{FPanel, fun() -> case process_info_fields(Pid) of
Fields when is_list(Fields) ->
observer_lib:update_info(UpFields, Fields);
_ -> ok
end
{FPanel, fun() ->
Fields = process_info_fields(Pid),
observer_lib:update_info(UpFields, Fields)
end}.

init_text_page(Parent) ->
Expand Down
4 changes: 2 additions & 2 deletions lib/observer/src/observer_sys_wx.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2011. All Rights Reserved.
%% Copyright Ericsson AB 2011-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
Expand Down Expand Up @@ -147,7 +147,7 @@ terminate(_Reason, _State) ->
ok.

code_change(_, _, State) ->
{stop, not_yet_implemented, State}.
{ok, State}.

handle_call(Msg, _From, State) ->
io:format("~p~p: Unhandled Call ~p~n",[?MODULE, ?LINE, Msg]),
Expand Down
4 changes: 2 additions & 2 deletions lib/observer/src/observer_trace_wx.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2011. All Rights Reserved.
%% Copyright Ericsson AB 2011-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
Expand Down Expand Up @@ -489,7 +489,7 @@ terminate(_Reason, #state{nodes=_Nodes}) ->
ok.

code_change(_, _, State) ->
{stop, not_yet_implemented, State}.
{ok, State}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
do_add_patterns({Module, NewPs}, State=#state{tpatterns=TPs0, m_view=Mview, f_view=Fview}) ->
Expand Down
12 changes: 11 additions & 1 deletion lib/observer/src/observer_tv_table.erl
Expand Up @@ -24,6 +24,8 @@
-export([init/1, handle_info/2, terminate/2, code_change/3, handle_call/3,
handle_event/2, handle_sync_event/3, handle_cast/2]).

-export([format/1]).

-include("observer_defs.hrl").
-import(observer_lib, [to_str/1]).

Expand Down Expand Up @@ -265,7 +267,8 @@ handle_event(#wx{id=?ID_DELETE},
wxStatusBar:setStatusText(StatusBar, io_lib:format("Deleted object: ~s",[Str])),
{noreply, State};

handle_event(#wx{id=?wxID_CLOSE}, State) ->
handle_event(#wx{id=?wxID_CLOSE}, State = #state{frame=Frame}) ->
wxFrame:destroy(Frame),
{stop, normal, State};

handle_event(Help = #wx{id=?wxID_HELP}, State) ->
Expand Down Expand Up @@ -747,6 +750,13 @@ format(List) when is_list(List) ->
format_list(List);
format(Bin) when is_binary(Bin), byte_size(Bin) > 100 ->
io_lib:format("<<#Bin:~w>>", [byte_size(Bin)]);
format(Bin) when is_binary(Bin) ->
try
true = printable_list(unicode:characters_to_list(Bin)),
io_lib:format("<<\"~ts\">>", [Bin])
catch _:_ ->
io_lib:format("~w", [Bin])
end;
format(Float) when is_float(Float) ->
io_lib:format("~.3g", [Float]);
format(Term) ->
Expand Down
17 changes: 11 additions & 6 deletions lib/observer/src/observer_wx.erl
Expand Up @@ -195,10 +195,13 @@ setup(#state{frame = Frame} = State) ->
%%Callbacks
handle_event(#wx{event=#wxNotebook{type=command_notebook_page_changing}},
#state{active_tab=Previous, node=Node} = State) ->
Pid = get_active_pid(State),
Previous ! not_active,
Pid ! {active, Node},
{noreply, State#state{active_tab=Pid}};
case get_active_pid(State) of
Previous -> {noreply, State};
Pid ->
Previous ! not_active,
Pid ! {active, Node},
{noreply, State#state{active_tab=Pid}}
end;

handle_event(#wx{event = #wxClose{}}, State) ->
{stop, normal, State};
Expand Down Expand Up @@ -350,7 +353,7 @@ terminate(_Reason, #state{frame = Frame}) ->
ok.

code_change(_, _, State) ->
{stop, not_yet_implemented, State}.
{ok, State}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Expand Down Expand Up @@ -410,7 +413,9 @@ connect2(NodeName, Opts, Cookie) ->
end.

change_node_view(Node, State) ->
get_active_pid(State) ! {active, Node},
Tab = get_active_pid(State),
Tab ! not_active,
Tab ! {active, Node},
StatusText = ["Observer - " | atom_to_list(Node)],
wxFrame:setTitle(State#state.frame, StatusText),
wxStatusBar:setStatusText(State#state.status_bar, StatusText),
Expand Down

0 comments on commit 8a165db

Please sign in to comment.