Qt 4.8
Static Public Functions | Static Private Attributes | Friends | List of all members
QSegfaultHandler Class Reference

#include <qcrashhandler_p.h>

Static Public Functions

static QtCrashHandler crashHandler ()
 
static void initialize (char **, int)
 
static void installCrashHandler (QtCrashHandler h)
 

Static Private Attributes

static QtCrashHandler callback = 0
 

Friends

void qt_signal_handler (int)
 

Detailed Description

Definition at line 64 of file qcrashhandler_p.h.

Functions

◆ crashHandler()

static QtCrashHandler QSegfaultHandler::crashHandler ( )
inlinestatic

Definition at line 72 of file qcrashhandler_p.h.

72 { return callback; }
static QtCrashHandler callback

◆ initialize()

void QSegfaultHandler::initialize ( char **  argv,
int  argc 
)
static

Definition at line 409 of file qcrashhandler.cpp.

410 {
411  init_backtrace(argv, argc);
412 
413  struct sigaction SignalAction;
414  SignalAction.sa_flags = 0;
415  SignalAction.sa_handler = qt_signal_handler;
416  sigemptyset(&SignalAction.sa_mask);
417  sigaction(SIGSEGV, &SignalAction, NULL);
418  sigaction(SIGBUS, &SignalAction, NULL);
419 }
friend void qt_signal_handler(int)
int sigaction(int, const struct sigaction *, struct sigaction *)
static void init_backtrace(char **argv, int argc)

◆ installCrashHandler()

static void QSegfaultHandler::installCrashHandler ( QtCrashHandler  h)
inlinestatic

Definition at line 71 of file qcrashhandler_p.h.

71 { callback = h; }
static QtCrashHandler callback

Friends and Related Functions

◆ qt_signal_handler

void qt_signal_handler ( int  sig)
friend

Definition at line 385 of file qcrashhandler.cpp.

Referenced by initialize().

386 {
387  signal(sig, SIG_DFL);
389  (*QSegfaultHandler::callback)();
390  _exit(1);
391  }
392  FILE *outb = stderr;
393  if(char *crash_loc = ::getenv("QT_CRASH_OUTPUT")) {
394  if(FILE *new_outb = fopen(crash_loc, "w")) {
395  fprintf(stderr, "Crash (backtrace written to %s)!!!\n", crash_loc);
396  outb = new_outb;
397  }
398  } else {
399  fprintf(outb, "Crash!!!\n");
400  }
401  print_backtrace(outb);
402  if(outb != stderr)
403  fclose(outb);
404  _exit(1);
405 }
static QtCrashHandler callback
static void print_backtrace(FILE *outb)

Properties

◆ callback

QtCrashHandler QSegfaultHandler::callback = 0
staticprivate

Definition at line 67 of file qcrashhandler_p.h.

Referenced by qt_signal_handler().


The documentation for this class was generated from the following files: