push 98438d20051787465e7a05f4aa66ab452afb1c14
[tagua/yd.git] / src / crash.cpp
blob361fcd9d75ded9042c89536a4b97fd9c25f3925c
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #include <QtGlobal>
12 #include "crash.h"
14 #if defined(Q_OS_UNIX) && defined(TAGUA_DEBUG)
16 #include <sys/types.h>
17 #include <unistd.h>
18 #include <stdio.h>
19 #include <signal.h>
20 #include <stdlib.h>
22 static void handler(int) {
23 printf("Sange & Crasha!!!!\n");
24 printf("I'm sorry, i crashed.\n");
25 printf("Now run somewhere\n");
26 printf(" gdb attach %d\n", getpid() );
27 exit(0);
31 void CrashHandler::install() {
32 signal(SIGSEGV, handler);
33 signal(SIGABRT, handler);
36 #else
38 void CrashHandler::install() { }
40 #endif