Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsDebug.h File Reference
#include "nscore.h"
#include "nsError.h"

Go to the source code of this file.

Defines

#define NS_ABORT_IF_FALSE(_expr, _msg)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 The non-debug version of these macros do not evaluate the expression or the message arguments to the macro.
#define NS_WARN_IF_FALSE(_expr, _msg)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_PRECONDITION(expr, str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ASSERTION(expr, str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_POSTCONDITION(expr, str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_NOTYETIMPLEMENTED(str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_NOTREACHED(str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ERROR(str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_WARNING(str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ABORT()   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_BREAK()   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ENSURE_TRUE(x, ret)
#define NS_ENSURE_FALSE(x, ret)   NS_ENSURE_TRUE(!(x), ret)
#define NS_ENSURE_SUCCESS(res, ret)   NS_ENSURE_TRUE(NS_SUCCEEDED(res), ret)
#define NS_ENSURE_ARG(arg)   NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_POINTER(arg)   NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_POINTER)
#define NS_ENSURE_ARG_MIN(arg, min)   NS_ENSURE_TRUE((arg) >= min, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_MAX(arg, max)   NS_ENSURE_TRUE((arg) <= max, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_RANGE(arg, min, max)   NS_ENSURE_TRUE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG)
#define NS_ENSURE_STATE(state)   NS_ENSURE_TRUE(state, NS_ERROR_UNEXPECTED)
#define NS_ENSURE_NO_AGGREGATION(outer)   NS_ENSURE_FALSE(outer, NS_ERROR_NO_AGGREGATION)
#define NS_ENSURE_PROPER_AGGREGATION(outer, iid)   NS_ENSURE_FALSE(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG)
#define NS_CheckThreadSafe(owningThread, msg)   NS_ASSERTION(owningThread == PR_GetCurrentThread(), msg)

Functions

PR_BEGIN_EXTERN_C NS_COM_GLUE
void NS_FASTCALL 
NSGlue_Warning (const char *aMessage, const char *aFile, PRIntn aLine)
 Namespace for debugging methods.
NS_COM_GLUE void NS_FASTCALL NSGlue_Abort (const char *aFile, PRIntn aLine)
 Abort the executing program.
NS_COM_GLUE void NS_FASTCALL NSGlue_Break (const char *aFile, PRIntn aLine)
 Break the executing program into the debugger.
NS_COM_GLUE void NS_FASTCALL NSGlue_Assertion (const char *aStr, const char *aExpr, const char *aFile, PRIntn aLine)
 Log an assertion message to the debug log.

Define Documentation

#define NS_ABORT ( )    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 214 of file nsDebug.h.

#define NS_ABORT_IF_FALSE (   _expr,
  _msg 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

The non-debug version of these macros do not evaluate the expression or the message arguments to the macro.

Definition at line 205 of file nsDebug.h.

#define NS_ASSERTION (   expr,
  str 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 208 of file nsDebug.h.

#define NS_BREAK ( )    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 215 of file nsDebug.h.

#define NS_CheckThreadSafe (   owningThread,
  msg 
)    NS_ASSERTION(owningThread == PR_GetCurrentThread(), msg)

Definition at line 275 of file nsDebug.h.

Definition at line 246 of file nsDebug.h.

#define NS_ENSURE_ARG_MAX (   arg,
  max 
)    NS_ENSURE_TRUE((arg) <= max, NS_ERROR_INVALID_ARG)

Definition at line 255 of file nsDebug.h.

Definition at line 252 of file nsDebug.h.

Definition at line 249 of file nsDebug.h.

#define NS_ENSURE_ARG_RANGE (   arg,
  min,
  max 
)    NS_ENSURE_TRUE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG)

Definition at line 258 of file nsDebug.h.

#define NS_ENSURE_FALSE (   x,
  ret 
)    NS_ENSURE_TRUE(!(x), ret)

Definition at line 232 of file nsDebug.h.

Definition at line 264 of file nsDebug.h.

Definition at line 267 of file nsDebug.h.

Definition at line 261 of file nsDebug.h.

#define NS_ENSURE_SUCCESS (   res,
  ret 
)    NS_ENSURE_TRUE(NS_SUCCEEDED(res), ret)

Definition at line 239 of file nsDebug.h.

#define NS_ENSURE_TRUE (   x,
  ret 
)
Value:
PR_BEGIN_MACRO                                              \
    if (NS_UNLIKELY(!(x))) {                                  \
       NS_WARNING("NS_ENSURE_TRUE(" #x ") failed");           \
       return ret;                                            \
    }                                                         \
  PR_END_MACRO

Definition at line 224 of file nsDebug.h.

#define NS_ERROR (   str)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 212 of file nsDebug.h.

#define NS_NOTREACHED (   str)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 211 of file nsDebug.h.

Definition at line 210 of file nsDebug.h.

#define NS_POSTCONDITION (   expr,
  str 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 209 of file nsDebug.h.

#define NS_PRECONDITION (   expr,
  str 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 207 of file nsDebug.h.

#define NS_WARN_IF_FALSE (   _expr,
  _msg 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 206 of file nsDebug.h.

#define NS_WARNING (   str)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Definition at line 213 of file nsDebug.h.


Function Documentation

NS_COM_GLUE void NS_FASTCALL NSGlue_Abort ( const char *  aFile,
PRIntn  aLine 
)

Abort the executing program.

This works on all architectures.

Definition at line 78 of file nsDebug.cpp.

{     
  if (!ENSURE_DEBUGOBJECT)
    return;    
  
  gDebugObject->Abort(aFile, aLine);
}     
NS_COM_GLUE void NS_FASTCALL NSGlue_Assertion ( const char *  aStr,
const char *  aExpr,
const char *  aFile,
PRIntn  aLine 
)

Log an assertion message to the debug log.

Definition at line 101 of file nsDebug.cpp.

{ 
  if (!ENSURE_DEBUGOBJECT)
    return;    
  gDebugObject->Assertion(aStr, aExpr, aFile, aLine);
}
NS_COM_GLUE void NS_FASTCALL NSGlue_Break ( const char *  aFile,
PRIntn  aLine 
)

Break the executing program into the debugger.

Definition at line 86 of file nsDebug.cpp.

{ 
  if (!ENSURE_DEBUGOBJECT)
    return;    
  
  gDebugObject->Break(aFile, aLine);
}
PR_BEGIN_EXTERN_C NS_COM_GLUE void NS_FASTCALL NSGlue_Warning ( const char *  aMessage,
const char *  aFile,
PRIntn  aLine 
)

Namespace for debugging methods.

Note that your code must use the macros defined later in this file so that the debug code can be conditionally compiled out. Log a warning message to the debug log.

Definition at line 94 of file nsDebug.cpp.

{ 
  if (!ENSURE_DEBUGOBJECT)
    return;    
  gDebugObject->Warning(aStr, aFile, aLine);
}