mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-11 14:30:08 +00:00
Add a few more crash tests for Android
This commit is contained in:
parent
fd0611f3a1
commit
13701b5497
@ -127,6 +127,18 @@ public class Apple2CrashHandler {
|
||||
public final String getTitle(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.crash_stackbuf_overflow);
|
||||
}
|
||||
},
|
||||
SIGABRT {
|
||||
@Override
|
||||
public final String getTitle(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.crash_sigabrt);
|
||||
}
|
||||
},
|
||||
SIGFPE {
|
||||
@Override
|
||||
public final String getTitle(Apple2Activity activity) {
|
||||
return activity.getResources().getString(R.string.crash_sigfpe);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
<string name="crasher_title">Crash emulator</string>
|
||||
<string name="crash_null">NULL-deref</string>
|
||||
<string name="crash_java_npe">Java NPE</string>
|
||||
<string name="crash_sigabrt">SIGABRT</string>
|
||||
<string name="crash_sigfpe">SIGFPE</string>
|
||||
<string name="crash_stackcall_overflow">stack call overflow</string>
|
||||
<string name="crash_stackbuf_overflow">stack buffer overflow</string>
|
||||
|
||||
|
@ -17,6 +17,8 @@ enum {
|
||||
CRASH_NULL_DEREF,
|
||||
CRASH_STACKCALL_OVERFLOW,
|
||||
CRASH_STACKBUF_OVERFLOW,
|
||||
CRASH_SIGABRT,
|
||||
CRASH_SIGFPE,
|
||||
// MOAR!
|
||||
};
|
||||
|
||||
@ -68,6 +70,21 @@ static volatile int __attribute__((noinline)) _crash_stackbuf_overflow(void) {
|
||||
return getpid();
|
||||
}
|
||||
|
||||
static void _crash_sigabrt(void) {
|
||||
kill(getpid(), SIGABRT);
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
static void _crash_sigfpe(void) {
|
||||
static volatile int foo = 2;
|
||||
static volatile int bar = 0;
|
||||
while (foo >= 0) {
|
||||
--foo;
|
||||
bar = 2/foo;
|
||||
}
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void Java_org_deadc0de_apple2ix_Apple2CrashHandler_nativePerformCrash(JNIEnv *env, jclass cls, jint crashType) {
|
||||
#warning FIXME TODO ... we should turn off test codepaths in release build =D
|
||||
LOG("... performing crash of type : %d", crashType);
|
||||
@ -85,6 +102,14 @@ void Java_org_deadc0de_apple2ix_Apple2CrashHandler_nativePerformCrash(JNIEnv *en
|
||||
_crash_stackbuf_overflow();
|
||||
break;
|
||||
|
||||
case CRASH_SIGABRT:
|
||||
_crash_sigabrt();
|
||||
break;
|
||||
|
||||
case CRASH_SIGFPE:
|
||||
_crash_sigfpe();
|
||||
break;
|
||||
|
||||
default:
|
||||
// unknown crasher, just abort ...
|
||||
abort();
|
||||
|
Loading…
x
Reference in New Issue
Block a user