~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/debugger/src/debugger.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-01 10:14:38 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090501101438-6qlr6rsdxgyzrg2z
Tags: 1:13.b-dfsg-2
* Cleaned up patches: removed unneeded patch which helped to support
  different SCTP library versions, made sure that changes for m68k
  architecture applied only when building on this architecture.
* Removed duplicated information from binary packages descriptions.
* Don't require libsctp-dev build-dependency on solaris-i386 architecture
  which allows to build Erlang on Nexenta (thanks to Tim Spriggs for
  the suggestion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%% ``The contents of this file are subject to the Erlang Public License,
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
 
5
%% 
 
6
%% The contents of this file are subject to the Erlang Public License,
2
7
%% Version 1.1, (the "License"); you may not use this file except in
3
8
%% compliance with the License. You should have received a copy of the
4
9
%% Erlang Public License along with this software. If not, it can be
5
 
%% retrieved via the world wide web at http://www.erlang.org/.
 
10
%% retrieved online at http://www.erlang.org/.
6
11
%% 
7
12
%% Software distributed under the License is distributed on an "AS IS"
8
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
14
%% the License for the specific language governing rights and limitations
10
15
%% under the License.
11
16
%% 
12
 
%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
 
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
 
%% AB. All Rights Reserved.''
15
 
%% 
16
 
%%     $Id$
 
17
%% %CopyrightEnd%
17
18
%%
18
19
-module(debugger).
19
20
 
20
21
%% External exports
21
 
-export([start/0, start/1, start/2, stop/0, quick/3]).
 
22
-export([start/0, start/1, start/2, stop/0, quick/3, auto_attach/1]).
22
23
 
23
24
%%==Erlang Debugger===================================================
24
25
%%
74
75
%%
75
76
%%====================================================================
76
77
start() ->
77
 
    dbg_ui_mon:start(global, default).
 
78
    start(global, default, default).
78
79
start(Mode) when Mode==local; Mode==global ->
79
 
    dbg_ui_mon:start(Mode, default);
80
 
start(SFile) when is_list(SFile) ->
81
 
    dbg_ui_mon:start(global, SFile).
 
80
    start(Mode, default, default);
 
81
start(Gui) when Gui==gs; Gui==wx ->
 
82
    start(global, default, Gui);
 
83
start(SFile) when is_list(SFile), is_integer(hd(SFile)) ->
 
84
    start(global, SFile, default).
 
85
 
82
86
start(Mode, SFile) ->
83
 
    dbg_ui_mon:start(Mode, SFile).
 
87
    start(Mode, SFile, default).
 
88
 
 
89
start(Mode, SFile, gs) ->
 
90
    dbg_ui_mon:start(Mode, SFile);
 
91
start(Mode, SFile, wx) ->
 
92
    dbg_wx_mon:start(Mode, SFile);
 
93
start(Mode, SFile, default) ->
 
94
    Gui = which_gui(),
 
95
    start(Mode, SFile, Gui).
84
96
 
85
97
stop() ->
86
98
    dbg_ui_mon:stop().
87
99
 
88
100
quick(M, F, A) ->
89
101
    int:i(M),
90
 
    int:auto_attach([init], {dbg_ui_trace, start, []}),
 
102
    auto_attach([init]),
91
103
    apply(M, F, A).
 
104
 
 
105
auto_attach(Flags) ->    
 
106
    case which_gui() of
 
107
        gs -> int:auto_attach(Flags, {dbg_ui_trace, start, []});
 
108
        wx -> int:auto_attach(Flags, {dbg_wx_trace, start, []})
 
109
    end.
 
110
 
 
111
which_gui() ->
 
112
    try
 
113
        wx:new(),
 
114
        wx:destroy(),
 
115
        wx
 
116
    catch _:_ ->
 
117
            gs
 
118
    end.