Added Crash reporting on OS X
This commit is contained in:
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Crash.cpp
|
||||||
|
* stepmania
|
||||||
|
*
|
||||||
|
* Created by Steve Checkoway on Thu Jul 31 2003.
|
||||||
|
* Copyright (c) 2003 Steve Checkoway. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Crash.h"
|
||||||
|
#include "archutils/Unix/CrashHandler.h"
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
static void *crashedFramePtr = NULL;
|
||||||
|
|
||||||
|
OSStatus HandleException(ExceptionInformation *theException)
|
||||||
|
{
|
||||||
|
crashedFramePtr = (void *)theException->registerImage->R1.lo;
|
||||||
|
if (!crashedFramePtr) {
|
||||||
|
write(fileno(stderr),
|
||||||
|
"***********************\n"
|
||||||
|
"It uses the high bytes!\n"
|
||||||
|
"***********************\n", 24*3);
|
||||||
|
crashedFramePtr = (void *)theException->registerImage->R1.hi;
|
||||||
|
}
|
||||||
|
CrashSignalHandler(theException->theKind);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *GetCrashedFramePtr()
|
||||||
|
{
|
||||||
|
return crashedFramePtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InformUserOfCrash()
|
||||||
|
{
|
||||||
|
CFStringRef error = CFStringCreateWithCString(NULL,
|
||||||
|
"StepMania has crashed. Debug information has been output to\n"
|
||||||
|
"\n"
|
||||||
|
" /tmp/crashinfo.txt\n"
|
||||||
|
"\n"
|
||||||
|
"Please report a bug at:\n"
|
||||||
|
"\n"
|
||||||
|
" http://sourceforge.net/tracker/?func=add&group_id=37892&atid=421366",
|
||||||
|
kCFStringEncodingASCII);
|
||||||
|
CFStringRef OK = CFStringCreateWithCString(NULL, "OK", kCFStringEncodingASCII);
|
||||||
|
struct AlertStdCFStringAlertParamRec params = {kStdCFStringAlertVersionOne, true, false, OK, NULL, NULL,
|
||||||
|
kAlertStdAlertOKButton, NULL, kWindowAlertPositionParentWindowScreen, NULL};
|
||||||
|
DialogRef dialog;
|
||||||
|
SInt16 unused;
|
||||||
|
|
||||||
|
CreateStandardAlert(kAlertStopAlert, error, NULL, ¶ms, &dialog);
|
||||||
|
AutoSizeDialog(dialog);
|
||||||
|
RunStandardAlert(dialog, NULL, &unused);
|
||||||
|
CFRelease(OK);
|
||||||
|
CFRelease(error);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef DARWIN_CRASH_H
|
||||||
|
#define DARWIN_CRASH_H
|
||||||
|
/*
|
||||||
|
* Crash.h
|
||||||
|
* stepmania
|
||||||
|
*
|
||||||
|
* Created by Steve Checkoway on Thu Jul 31 2003.
|
||||||
|
* Copyright (c) 2003 Steve Checkoway. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include <MachineExceptions.h>
|
||||||
|
|
||||||
|
OSStatus HandleException(ExceptionInformation *theException);
|
||||||
|
void *GetCrashedFramePtr();
|
||||||
|
void InformUserOfCrash();
|
||||||
|
|
||||||
|
#endif /* DARWIN_CRASH_H */
|
||||||
@@ -6,3 +6,5 @@
|
|||||||
#define NEED_COSF
|
#define NEED_COSF
|
||||||
#define NEED_TANF
|
#define NEED_TANF
|
||||||
#define NEED_ACOSF
|
#define NEED_ACOSF
|
||||||
|
#define BACKTRACE_LOOKUP_METHOD_ATOS
|
||||||
|
#define BACKTRACE_METHOD_POWERPC_DARWIN
|
||||||
|
|||||||
Reference in New Issue
Block a user