1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 1997-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20-module(debugger). 21 22%% External exports 23-export([start/0, start/1, start/2, stop/0, quick/3, auto_attach/1]). 24 25%%==Erlang Debugger=================================================== 26%% 27%% Graphical user interface to the Erlang Interpreter. 28%% The code for each process is divided into two modules, Name.erl 29%% and Name_win.erl, where Name.erl contains the logic and 30%% Name_win.erl the GS specific functionality. 31%% 32%% debugger 33%% -------- 34%% Interface module. 35%% 36%% dbg_wx_winman 37%% ------------- 38%% Window manager, keeping track of open windows and Debugger 39%% processes. 40%% 41%% dbg_wx_mon, dbg_wx_mon_win 42%% -------------------------- 43%% Monitor window, main window of Debugger, displaying information 44%% about interpreted modules and debugged processes. 45%% 46%% dbg_wx_trace, dbg_wx_trace_win 47%% ------------------------------ 48%% Attach process window, showing the code executed by a debugged 49%% process and providing a GUI for stepping, inspecting variables etc. 50%% 51%% dbg_wx_break, dbg_wx_break_win 52%% ------------------------------ 53%% Help window for creating new breakpoints. 54%% 55%% dbg_wx_interpret, dbg_wx_filedialog_win 56%% -------------------------------------- 57%% Help window for selecting modules to interpret. 58%% 59%% dbg_wx_settings, dbg_wx_filedialog_win 60%% -------------------------------------- 61%% Help window for saving and loading Debugger settings. 62%% 63%% dbg_wx_view 64%% ----------- 65%% Help window for viewing interpreted modules (uses dbg_wx_trace_win). 66%% 67%% dbg_wx_win 68%% ---------- 69%% GUI specific functionality used by more than one window type. 70%% 71%%==================================================================== 72start() -> 73 start(global, default, default). 74start(Mode) when Mode==local; Mode==global -> 75 start(Mode, default, default); 76start(Gui) when Gui==wx -> 77 start(global, default, Gui); 78start(SFile) when is_list(SFile), is_integer(hd(SFile)) -> 79 start(global, SFile, default). 80 81start(Mode, SFile) -> 82 start(Mode, SFile, default). 83 84start(Mode, SFile, wx) -> 85 dbg_wx_mon:start(Mode, SFile); 86start(Mode, SFile, default) -> 87 Gui = which_gui(), 88 start(Mode, SFile, Gui). 89 90stop() -> 91 dbg_wx_mon:stop(). 92 93quick(M, F, A) -> 94 int:i(M), 95 auto_attach([init]), 96 apply(M, F, A). 97 98auto_attach(Flags) -> 99 case which_gui() of 100 wx -> int:auto_attach(Flags, {dbg_wx_trace, start, []}) 101 end. 102 103which_gui() -> wx. 104