diff options
author | Dan Gudmundsson <[email protected]> | 2014-03-28 10:13:21 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2014-03-28 10:13:21 +0100 |
commit | e3f9bf8dbfe4e055753f04125406d29af0ae1050 (patch) | |
tree | 7f56c99e508b1d14a08fe5e9a757ddf4453d414c /lib/observer/src | |
parent | 95ffe7eb374f59ce3f289747212adf042c1cd703 (diff) | |
parent | a7d0e35b834f9b0d9538c75d06dfe3d698a83ded (diff) | |
download | otp-e3f9bf8dbfe4e055753f04125406d29af0ae1050.tar.gz otp-e3f9bf8dbfe4e055753f04125406d29af0ae1050.tar.bz2 otp-e3f9bf8dbfe4e055753f04125406d29af0ae1050.zip |
Merge branch 'dgud/observer/test'
* dgud/observer/test:
observer: Add simple test and add debug hooks in app
Diffstat (limited to 'lib/observer/src')
-rw-r--r-- | lib/observer/src/observer.erl | 7 | ||||
-rw-r--r-- | lib/observer/src/observer_procinfo.erl | 5 | ||||
-rw-r--r-- | lib/observer/src/observer_tv_wx.erl | 6 | ||||
-rw-r--r-- | lib/observer/src/observer_wx.erl | 13 |
4 files changed, 25 insertions, 6 deletions
diff --git a/lib/observer/src/observer.erl b/lib/observer/src/observer.erl index 098100e8ee..a30ceecc63 100644 --- a/lib/observer/src/observer.erl +++ b/lib/observer/src/observer.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011. All Rights Reserved. +%% Copyright Ericsson AB 2011-2014. 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 @@ -18,8 +18,11 @@ -module(observer). --export([start/0]). +-export([start/0, stop/0]). start() -> observer_wx:start(). + +stop() -> + observer_wx:stop(). diff --git a/lib/observer/src/observer_procinfo.erl b/lib/observer/src/observer_procinfo.erl index 3ffa5fc77d..8e8a37fc93 100644 --- a/lib/observer/src/observer_procinfo.erl +++ b/lib/observer/src/observer_procinfo.erl @@ -34,6 +34,7 @@ -record(state, {parent, frame, + notebook, pid, pages=[], expand_table, @@ -76,6 +77,7 @@ init([Pid, ParentFrame, Parent]) -> {Frame, #state{parent=Parent, pid=Pid, frame=Frame, + notebook=Notebook, pages=[ProcessPage,MessagePage,DictPage,StackPage,StatePage], expand_table=Table }} @@ -158,6 +160,9 @@ handle_event(#wx{event=#wxHtmlLink{linkInfo=#wxHtmlLinkInfo{href=Info}}}, State) handle_event(Event, _State) -> error({unhandled_event, Event}). +handle_info({get_debug_info, From}, State = #state{notebook=Notebook}) -> + From ! {procinfo_debug, Notebook}, + {noreply, State}; handle_info(_Info, State) -> %% io:format("~p: ~p, Handle info: ~p~n", [?MODULE, ?LINE, Info]), {noreply, State}. diff --git a/lib/observer/src/observer_tv_wx.erl b/lib/observer/src/observer_tv_wx.erl index b276965f83..da4cb8e041 100644 --- a/lib/observer/src/observer_tv_wx.erl +++ b/lib/observer/src/observer_tv_wx.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2012. All Rights Reserved. +%% Copyright Ericsson AB 2011-2014. 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 @@ -132,8 +132,8 @@ handle_event(#wx{event=#wxSize{size={W,_}}}, State=#state{grid=Grid}) -> observer_lib:set_listctrl_col_size(Grid, W), {noreply, State}; -handle_event(#wx{obj=Grid, event=#wxList{type=command_list_item_activated, - itemIndex=Index}}, +handle_event(#wx{event=#wxList{type=command_list_item_activated, + itemIndex=Index}}, State=#state{grid=Grid, node=Node, opt=#opt{type=Type}, tabs=Tabs}) -> Table = lists:nth(Index+1, Tabs), case Table#tab.protection of diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl index ecb8e132fe..ced26f7119 100644 --- a/lib/observer/src/observer_wx.erl +++ b/lib/observer/src/observer_wx.erl @@ -19,7 +19,7 @@ -behaviour(wx_object). --export([start/0]). +-export([start/0, stop/0]). -export([create_menus/2, get_attrib/1, get_tracer/0, set_status/1, create_txt_dialog/4, try_rpc/4, return_to_localnode/2]). @@ -69,6 +69,9 @@ start() -> _Obj -> ok end. +stop() -> + wx_object:call(observer, stop). + create_menus(Object, Menus) when is_list(Menus) -> wx_object:call(Object, {create_menus, Menus}). @@ -331,6 +334,10 @@ handle_call({get_attrib, Attrib}, _From, State) -> handle_call(get_tracer, _From, State=#state{trace_panel=TraceP}) -> {reply, TraceP, State}; +handle_call(stop, _, State = #state{frame = Frame}) -> + wxFrame:destroy(Frame), + {stop, normal, ok, State}; + handle_call(_Msg, _From, State) -> {reply, ok, State}. @@ -367,6 +374,10 @@ handle_info({open_link, Pid0}, State = #state{pro_panel=ProcViewer, frame=Frame} end, {noreply, State}; +handle_info({get_debug_info, From}, State = #state{notebook=Notebook, active_tab=Pid}) -> + From ! {observer_debug, wx:get_env(), Notebook, Pid}, + {noreply, State}; + handle_info({'EXIT', Pid, _Reason}, State) -> io:format("Child (~s) crashed exiting: ~p ~p~n", [pid2panel(Pid, State), Pid,_Reason]), |