summaryrefslogtreecommitdiff
path: root/xpcom/base/nsIDebug2.idl
blob: b2b6ccfb6a6db782a881b5cbea3c5f59050c631b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* interface to expose information about calls to NS_DebugBreak */

#include "nsISupports.idl"

/**
 *   For use by consumers in scripted languages (JavaScript, Java, Python,
 *   Perl, ...).
 *
 *   @note C/C++ consumers who are planning to use the nsIDebug2 interface with
 *   the "@mozilla.org/xpcom;1" contract should use NS_DebugBreak from xpcom
 *   glue instead.
 *
 */

[scriptable, uuid(9641dc15-10fb-42e3-a285-18be90a5c10b)]
interface nsIDebug2 : nsISupports
{
    /**
     * Whether XPCOM was compiled with DEBUG defined.  This often
     * correlates to whether other code was compiled with DEBUG defined.
     */
    readonly attribute boolean isDebugBuild;

    /**
     * The number of assertions since process start.
     */
    readonly attribute long assertionCount;

    /**
     * Whether a debugger is currently attached.
     * Supports Windows + Mac
     */
    readonly attribute bool isDebuggerAttached;

    /**
     * Show an assertion and trigger nsIDebug2.break().
     *
     * @param aStr assertion message
     * @param aExpr expression that failed
     * @param aFile file containing assertion
     * @param aLine line number of assertion
     */
    void assertion(in string aStr,
                   in string aExpr,
                   in string aFile, 
                   in long aLine);

    /**
     * Show a warning.
     *
     * @param aStr warning message
     * @param aFile file containing assertion
     * @param aLine line number of assertion
     */
    void warning(in string aStr,
                 in string aFile,
                 in long aLine);

    /**
     * Request to break into a debugger.
     *
     * @param aFile file containing break request
     * @param aLine line number of break request
     */
    void break(in string aFile, 
               in long aLine);

    /**
     * Request the process to trigger a fatal abort.
     *
     * @param aFile file containing abort request
     * @param aLine line number of abort request
     */
    void abort(in string aFile, 
               in long aLine);
};