~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/hipe/tools/hipe_tool.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%% -*- erlang-indent-level: 2 -*-
2
2
%%
3
3
%% %CopyrightBegin%
4
 
%% 
5
 
%% Copyright Ericsson AB 2002-2009. All Rights Reserved.
6
 
%% 
 
4
%%
 
5
%% Copyright Ericsson AB 2002-2010. All Rights Reserved.
 
6
%%
7
7
%% The contents of this file are subject to the Erlang Public License,
8
8
%% Version 1.1, (the "License"); you may not use this file except in
9
9
%% compliance with the License. You should have received a copy of the
10
10
%% Erlang Public License along with this software. If not, it can be
11
11
%% retrieved online at http://www.erlang.org/.
12
 
%% 
 
12
%%
13
13
%% Software distributed under the License is distributed on an "AS IS"
14
14
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15
15
%% the License for the specific language governing rights and limitations
16
16
%% under the License.
17
 
%% 
 
17
%%
18
18
%% %CopyrightEnd%
19
19
%%
20
20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56
56
 
57
57
-record(state, {win_created = false     :: boolean(),
58
58
                mindex = 0              :: integer(),
59
 
                mod                     :: module(),
 
59
                mod                     :: atom(),
60
60
                funs = []               :: [fa()],
61
 
                mods = []               :: [module()],
 
61
                mods = []               :: [atom()],
62
62
                options = [o2]          :: comp_options(),
63
63
                compiling = false       :: 'false' | pid()
64
64
               }).
291
291
                      integer_to_list(length(Mods))++")"),
292
292
          catch gs:config(code_listbox, [{data, Mods},
293
293
                                         {items, Mods},
294
 
                                         {selection, 0}
295
 
                                        ]),
 
294
                                         {selection, 0}]),
296
295
          update_module_box(State#state{mods = Mods}, 0, Mods, "")  
297
296
      end
298
297
  end.
367
366
%% @doc Returns a list of all loaded modules. 
368
367
%%---------------------------------------------------------------------
369
368
 
370
 
-spec mods() -> [module()].
 
369
-spec mods() -> [atom()].
371
370
 
372
371
mods() ->
373
372
  [Mod || {Mod,_File} <- code:all_loaded()].
382
381
native_code(Mod) ->
383
382
  Mod:module_info(native_addresses).
384
383
 
385
 
-spec mfas(module(), [fa()]) -> [mfa()].
 
384
-spec mfas(atom(), [fa()]) -> [mfa()].
386
385
 
387
386
mfas(Mod, Funs) ->
388
387
  [{Mod,F,A} || {F,A} <- Funs].
389
388
 
390
 
-spec fun_names(module(), [fa()], [fa_address()], boolean()) -> string().
 
389
-spec fun_names(atom(), [fa()], [fa_address()], boolean()) -> [string()].
391
390
 
392
391
fun_names(M, Funs, NativeCode, Prof) ->
393
 
  [list_to_atom(atom_to_list(F) ++ "/" ++ integer_to_list(A) ++
394
 
                (case in_native(F, A, NativeCode) of
395
 
                   true -> " [native] ";
396
 
                   false -> ""
397
 
                 end)
398
 
                ++
399
 
                if Prof -> 
400
 
                    (catch integer_to_list(hipe_bifs:call_count_get({M,F,A})));
401
 
                   true -> ""
402
 
                end) ||
403
 
      {F,A} <- Funs].
 
392
  [atom_to_list(F) ++ "/" ++ integer_to_list(A)
 
393
   ++
 
394
     (case in_native(F, A, NativeCode) of
 
395
        true -> " [native] ";
 
396
        false -> ""
 
397
      end)
 
398
   ++
 
399
     if Prof ->
 
400
         (catch integer_to_list(hipe_bifs:call_count_get({M,F,A})));
 
401
        true -> ""
 
402
     end
 
403
   || {F,A} <- Funs].
404
404
 
405
405
-spec in_native(atom(), arity(), [fa_address()]) -> boolean().
406
406
 
461
461
    false -> []
462
462
  end.
463
463
 
464
 
-spec is_profiled(module()) -> boolean().
 
464
-spec is_profiled(atom()) -> boolean().
465
465
 
466
466
is_profiled(Mod) ->
467
467
  case hipe_bifs:call_count_get({Mod,module_info,0}) of
478
478
  P = spawn(fun() -> c(Parent, State#state.mod, State#state.options) end),
479
479
  State#state{compiling = P}.
480
480
 
481
 
-spec c(pid(), module(), comp_options()) -> 'ok'.
 
481
-spec c(pid(), atom(), comp_options()) -> 'ok'.
482
482
 
483
483
c(Parent, Mod, Options) ->
484
484
  Res = hipe:c(Mod, Options),
506
506
  ok.
507
507
 
508
508
edoc(Name, Opts) ->
509
 
  Doc = edoc:get_doc([Name, Opts]),
 
509
  Doc = edoc:get_doc(Name, Opts),
510
510
  %% Comments = edoc:read_comments(Name, Opts),
511
511
  %% Text = edoc:forms(Forms, Comments, Name, Opts),
512
 
  edoc:layout([Doc, Opts]),
 
512
  edoc:layout(Doc, Opts),
513
513
  ok.