OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Functions | Variables
crashcatcher.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/utsname.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <pthread.h>
#include <stdbool.h>
#include <sys/ptrace.h>
#include <string>
#include <SDL_messagebox.h>
Include dependency graph for crashcatcher.cpp:

Macros

#define UNUSED(x)   (void)(x)
 
#define PATH_MAX   256
 

Functions

static void gdb_info (pid_t pid)
 
static void sys_info (void)
 
static size_t safe_write (int fd, const void *buf, size_t len)
 
static void crash_catcher (int signum, siginfo_t *siginfo, void *context)
 
static void crash_handler (const char *logfile)
 
int cc_install_handlers (int argc, char **argv, int num_signals, int *signals, const char *logfile, int(*user_info)(char *, char *))
 
bool is_debugger_attached (void)
 

Variables

static const char crash_switch [] = "--cc-handle-crash"
 
static const char fatal_err [] = "\n\n*** Fatal Error ***\n"
 
static const char pipe_err [] = "!!! Failed to create pipe\n"
 
static const char fork_err [] = "!!! Failed to fork debug process\n"
 
static const char exec_err [] = "!!! Failed to exec debug process\n"
 
static char argv0 [PATH_MAX]
 
static char altstack [SIGSTKSZ]
 
struct {
   int   signum
 
   pid_t   pid
 
   int   has_siginfo
 
   siginfo_t   siginfo
 
   char   buf [1024]
 
crash_info
 
struct {
   const char *   name
 
   int   signum
 
signals []
 
struct {
   int   code
 
   const char *   name
 
sigill_codes []
 
struct {
   int   code
 
   const char *   name
 
sigfpe_codes []
 
struct {
   int   code
 
   const char *   name
 
sigsegv_codes []
 
struct {
   int   code
 
   const char *   name
 
sigbus_codes []
 
static int(* cc_user_info )(char *, char *)
 

Macro Definition Documentation

#define PATH_MAX   256
#define UNUSED (   x)    (void)(x)

Function Documentation

int cc_install_handlers ( int  argc,
char **  argv,
int  num_signals,
int signals,
const char *  logfile,
int(*)(char *, char *)  user_info 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static void crash_catcher ( int  signum,
siginfo_t *  siginfo,
void *  context 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void crash_handler ( const char *  logfile)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void gdb_info ( pid_t  pid)
static

Here is the caller graph for this function:

bool is_debugger_attached ( void  )

Here is the caller graph for this function:

static size_t safe_write ( int  fd,
const void *  buf,
size_t  len 
)
static

Here is the caller graph for this function:

static void sys_info ( void  )
static

Here is the caller graph for this function:

Variable Documentation

char altstack[SIGSTKSZ]
static
char argv0[PATH_MAX]
static
char buf[1024]
int(* cc_user_info)(char *, char *)
static
int code
struct { ... } crash_info
const char crash_switch[] = "--cc-handle-crash"
static
const char exec_err[] = "!!! Failed to exec debug process\n"
static
const char fatal_err[] = "\n\n*** Fatal Error ***\n"
static
const char fork_err[] = "!!! Failed to fork debug process\n"
static
int has_siginfo
const char* name
pid_t pid
const char pipe_err[] = "!!! Failed to create pipe\n"
static
const { ... } sigbus_codes[]
Initial value:
= {
{ BUS_ADRALN, "Invalid address alignment" },
{ BUS_ADRERR, "Non-existent physical address" },
{ BUS_OBJERR, "Object specific hardware error" },
{ 0, NULL }
}
const { ... } sigfpe_codes[]
Initial value:
= {
{ FPE_INTDIV, "Integer divide by zero" },
{ FPE_INTOVF, "Integer overflow" },
{ FPE_FLTDIV, "Floating point divide by zero" },
{ FPE_FLTOVF, "Floating point overflow" },
{ FPE_FLTUND, "Floating point underflow" },
{ FPE_FLTRES, "Floating point inexact result" },
{ FPE_FLTINV, "Floating point invalid operation" },
{ FPE_FLTSUB, "Subscript out of range" },
{ 0, NULL }
}
const { ... } sigill_codes[]
Initial value:
= {
{ ILL_ILLOPC, "Illegal opcode" },
{ ILL_ILLOPN, "Illegal operand" },
{ ILL_ILLADR, "Illegal addressing mode" },
{ ILL_ILLTRP, "Illegal trap" },
{ ILL_PRVOPC, "Privileged opcode" },
{ ILL_PRVREG, "Privileged register" },
{ ILL_COPROC, "Coprocessor error" },
{ ILL_BADSTK, "Internal stack error" },
{ 0, NULL }
}
siginfo_t siginfo
const { ... } signals[]
Initial value:
= {
{ "Segmentation fault", SIGSEGV },
{ "Illegal instruction", SIGILL },
{ "FPU exception", SIGFPE },
{ "System BUS error", SIGBUS },
{ NULL, 0 }
}
int signum
const { ... } sigsegv_codes[]
Initial value:
= {
{ SEGV_MAPERR, "Address not mapped to object" },
{ SEGV_ACCERR, "Invalid permissions for mapped object" },
{ 0, NULL }
}