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

« back to all changes in this revision

Viewing changes to lib/kernel/src/error_handler.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 1996-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(error_handler).
19
20
 
22
23
-export([undefined_function/3, undefined_lambda/3, stub_function/3,
23
24
         breakpoint/3]).
24
25
 
25
 
-spec(undefined_function/3 :: (
26
 
        Module :: atom(),
27
 
        Function :: atom(),
28
 
        Args :: list()) ->
29
 
        any()).
 
26
-spec undefined_function(Module :: atom(), Function :: atom(), Args :: [_]) ->
 
27
        any().
30
28
 
31
29
undefined_function(Module, Func, Args) ->
32
30
    case ensure_loaded(Module) of
48
46
            crash(Module, Func, Args)
49
47
    end.
50
48
 
51
 
-spec(undefined_lambda/3 :: (
52
 
        Module :: atom(),
53
 
        Function :: fun(),
54
 
        Args :: list()) ->
55
 
        any()).
 
49
-spec undefined_lambda(Module :: atom(), Function :: fun(), Args :: [_]) ->
 
50
        any().
56
51
 
57
52
undefined_lambda(Module, Fun, Args) ->
58
53
    case ensure_loaded(Module) of
66
61
            crash(Fun, Args)
67
62
    end.
68
63
 
69
 
-spec(breakpoint/3 :: (
70
 
        Module :: atom(),
71
 
        Function :: atom(),
72
 
        Args :: list()) ->
73
 
        any()).
 
64
-spec breakpoint(Module :: atom(), Function :: atom(), Args :: [_]) ->
 
65
        any().
74
66
 
75
67
breakpoint(Module, Func, Args) ->
76
68
    (int()):eval(Module, Func, Args).
89
81
crash(M, F, A) ->
90
82
    crash({M,F,A}).
91
83
 
92
 
-spec(crash/1 :: (tuple()) -> no_return()).
93
 
crash(MFA) ->
 
84
-spec crash(tuple()) -> no_return().
 
85
 
 
86
crash(Tuple) ->
94
87
    try erlang:error(undef)
95
88
    catch
96
89
        error:undef ->
97
 
            erlang:raise(error, undef, [MFA|tl(erlang:get_stacktrace())])
 
90
            erlang:raise(error, undef, [Tuple|tl(erlang:get_stacktrace())])
98
91
    end.
99
92
 
100
93
%% If the code_server has not been started yet dynamic code loading
117
110
            init:ensure_loaded(Module)
118
111
    end.
119
112
 
 
113
-spec stub_function(atom(), atom(), [_]) -> no_return().
 
114
 
120
115
stub_function(Mod, Func, Args) ->
121
116
    exit({undef,[{Mod,Func,Args}]}).
122
117