Back to index

enigmail  1.4.3
Functions
Assertions.cpp File Reference
#include "mozilla/Attributes.h"
#include "mozilla/Types.h"
#include <cstdio>
#include <cstdlib>
#include <signal.h>

Go to the source code of this file.

Functions

 MOZ_Crash ()
 MOZ_Assert (const char *s, const char *file, int ln)

Function Documentation

MOZ_Assert ( const char *  s,
const char *  file,
int  ln 
)

Definition at line 84 of file Assertions.cpp.

{
  fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
  fflush(stderr);
  MOZ_Crash();
}

Here is the call graph for this function:

MOZ_Crash ( )

Definition at line 55 of file Assertions.cpp.

{
  /*
   * We write 123 here so that the machine code for this function is
   * unique. Otherwise the linker, trying to be smart, might use the
   * same code for MOZ_Crash and for some other function. That
   * messes up the signature in minidumps.
   */

#if defined(WIN32)
  /*
   * We used to call DebugBreak() on Windows, but amazingly, it causes
   * the MSVS 2010 debugger not to be able to recover a call stack.
   */
  *((volatile int *) NULL) = 123;
  exit(3);
#elif defined(__APPLE__)
  /*
   * On Mac OS X, Breakpad ignores signals. Only real Mach exceptions are
   * trapped.
   */
  *((volatile int *) NULL) = 123;  /* To continue from here in GDB: "return" then "continue". */
  raise(SIGABRT);  /* In case above statement gets nixed by the optimizer. */
#else
  raise(SIGABRT);  /* To continue from here in GDB: "signal 0". */
#endif
}

Here is the caller graph for this function: