Created
July 2, 2009 16:39
-
-
Save pcapriotti/139587 to your computer and use it in GitHub Desktop.
Show a ruby backtrace on a native code crash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "extensions.h" | |
| #include <QCoreApplication> | |
| #include <kdemacros.h> | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <signal.h> | |
| #include <ruby.h> | |
| Extensions::Extensions(QObject* parent) | |
| : QObject(parent) { } | |
| static void init() | |
| { | |
| Extensions* ext = new Extensions(QCoreApplication::instance()); | |
| ext->setObjectName("kaya extensions"); | |
| } | |
| static void crash_handler(int signum) | |
| { | |
| rb_raise(rb_eException, "Native code crash!"); | |
| } | |
| extern "C" KDE_EXPORT void Init_extensions() { | |
| init(); | |
| signal(SIGSEGV, crash_handler); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment