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

« back to all changes in this revision

Viewing changes to lib/runtime_tools/src/dbg.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
%%
2
2
%% %CopyrightBegin%
3
 
%% 
4
 
%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
5
 
%% 
 
3
%%
 
4
%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
 
5
%%
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
11
 
%% 
 
11
%%
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
16
 
%% 
 
16
%%
17
17
%% %CopyrightEnd%
18
18
%%
19
19
-module(dbg).
945
945
dhandler(Trace, Out) when element(1, Trace) == trace, tuple_size(Trace) >= 3 ->
946
946
    dhandler1(Trace, tuple_size(Trace), Out);
947
947
dhandler(Trace, Out) when element(1, Trace) == trace_ts, tuple_size(Trace) >= 4 ->
948
 
    dhandler1(Trace, tuple_size(Trace)-1, Out);
 
948
    dhandler1(Trace, tuple_size(Trace)-1, element(tuple_size(Trace),Trace), Out);
949
949
dhandler(Trace, Out) when element(1, Trace) == drop, tuple_size(Trace) =:= 2 ->
950
950
    io:format(Out, "*** Dropped ~p messages.~n", [element(2,Trace)]),
951
951
    Out;
978
978
    Out.
979
979
 
980
980
dhandler1(Trace, Size, Out) ->
981
 
%%%!    Self = self(),
982
981
    From = element(2, Trace),
983
982
    case element(3, Trace) of
984
983
        'receive' ->
985
984
            case element(4, Trace) of
986
985
                {dbg,ok} -> ok;
987
 
                Message -> io:format(Out, "(~p) << ~p~n", [From,Message])
 
986
                Message ->
 
987
                    io:format(Out, "(~p) << ~p~n", [From,Message])
988
988
            end;
989
989
        'send' ->
990
990
            Message = element(4, Trace),
991
 
            case element(5, Trace) of
992
 
%%%! This causes messages to disappear when used by ttb (observer). Tests
993
 
%%%! so far show that there is no difference in results with dbg even if I
994
 
%%%! comment it out, so  I hope this is only some old code which isn't
995
 
%%%! needed anymore... /siri
996
 
%%%!            Self -> ok;
997
 
                To -> io:format(Out, "(~p) ~p ! ~p~n", [From,To,Message])
998
 
            end;
 
991
            To = element(5, Trace),
 
992
            io:format(Out, "(~p) ~p ! ~p~n", [From,To,Message]);
999
993
        call ->
1000
994
            case element(4, Trace) of
1001
995
                MFA when Size == 5 ->
1028
1022
    end,
1029
1023
    Out.
1030
1024
 
 
1025
dhandler1(Trace, Size, TS, Out) ->
 
1026
    From = element(2, Trace),
 
1027
    case element(3, Trace) of
 
1028
        'receive' ->
 
1029
            case element(4, Trace) of
 
1030
                {dbg,ok} -> ok;
 
1031
                Message ->
 
1032
                    io:format(Out, "(~p) << ~p (Timestamp: ~p)~n", [From,Message,TS])
 
1033
            end;
 
1034
        'send' ->
 
1035
            Message = element(4, Trace),
 
1036
            To = element(5, Trace),
 
1037
            io:format(Out, "(~p) ~p ! ~p (Timestamp: ~p)~n", [From,To,Message,TS]);
 
1038
        call ->
 
1039
            case element(4, Trace) of
 
1040
                MFA when Size == 5 ->
 
1041
                    Message = element(5, Trace),
 
1042
                    io:format(Out, "(~p) call ~s (~p) (Timestamp: ~p)~n", [From,ffunc(MFA),Message,TS]);
 
1043
                MFA ->
 
1044
                    io:format(Out, "(~p) call ~s (Timestamp: ~p)~n", [From,ffunc(MFA),TS])
 
1045
            end;
 
1046
        return -> %% To be deleted...
 
1047
            case element(4, Trace) of
 
1048
                MFA when Size == 5 ->
 
1049
                    Ret = element(5, Trace),
 
1050
                    io:format(Out, "(~p) old_ret ~s -> ~p (Timestamp: ~p)~n", [From,ffunc(MFA),Ret,TS]);
 
1051
                MFA ->
 
1052
                    io:format(Out, "(~p) old_ret ~s (Timestamp: ~p)~n", [From,ffunc(MFA),TS])
 
1053
            end;
 
1054
        return_from ->
 
1055
            MFA = element(4, Trace),
 
1056
            Ret = element(5, Trace),
 
1057
            io:format(Out, "(~p) returned from ~s -> ~p (Timestamp: ~p)~n", [From,ffunc(MFA),Ret,TS]);
 
1058
        return_to ->
 
1059
            MFA = element(4, Trace),
 
1060
            io:format(Out, "(~p) returning to ~s (Timestamp: ~p)~n", [From,ffunc(MFA),TS]);
 
1061
        spawn when Size == 5 ->
 
1062
            Pid = element(4, Trace),
 
1063
            MFA = element(5, Trace),
 
1064
            io:format(Out, "(~p) spawn ~p as ~s (Timestamp: ~p)~n", [From,Pid,ffunc(MFA),TS]);
 
1065
        Op ->
 
1066
            io:format(Out, "(~p) ~p ~s (Timestamp: ~p)~n", [From,Op,ftup(Trace,4,Size),TS])
 
1067
    end,
 
1068
    Out.
 
1069
 
1031
1070
 
1032
1071
 
1033
1072
%%% These f* functions returns non-flat strings