mirror of
https://github.com/deadw00d/AROS.git
synced 2025-11-19 08:11:43 +00:00
add a few variations of execs crash test
This commit is contained in:
27
developer/debug/test/exec/crashtest_highpagefault.c
Normal file
27
developer/debug/test/exec/crashtest_highpagefault.c
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2025, The AROS Development Team. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
void crashfunc()
|
||||
{
|
||||
#if __WORDSIZE==64
|
||||
volatile LONG *ptr = (LONG *)0xFFFF000000000000ULL;
|
||||
#else
|
||||
volatile LONG *ptr = (LONG *)0xFFFF0000UL;
|
||||
#endif
|
||||
|
||||
PutStr("Before crash\n");
|
||||
*ptr = 20;
|
||||
PutStr("After crash\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
PutStr("main() enter\n");
|
||||
crashfunc();
|
||||
PutStr("main() exit\n");
|
||||
return 0;
|
||||
}
|
||||
22
developer/debug/test/exec/crashtest_illegalins.c
Normal file
22
developer/debug/test/exec/crashtest_illegalins.c
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright (C) 2025, The AROS Development Team. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
void crashfunc()
|
||||
{
|
||||
void (*bad)() = (void(*)())"abcd";
|
||||
PutStr("Before crash\n");
|
||||
bad();
|
||||
PutStr("After crash\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
PutStr("main() enter\n");
|
||||
crashfunc();
|
||||
PutStr("main() exit\n");
|
||||
return 0;
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2013, The AROS Development Team. All rights reserved.
|
||||
Copyright (C) 2013-2025, The AROS Development Team. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
24
developer/debug/test/exec/crashtest_unaligned.c
Normal file
24
developer/debug/test/exec/crashtest_unaligned.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2025, The AROS Development Team. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
/* on strict-alignment architectures this should crash */
|
||||
void crashfunc()
|
||||
{
|
||||
char buf[5];
|
||||
LONG *unaligned = (LONG *)(buf + 1);
|
||||
PutStr("Before crash\n");
|
||||
*unaligned = 0x12345678;
|
||||
PutStr("After crash\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
PutStr("main() enter\n");
|
||||
crashfunc();
|
||||
PutStr("main() exit\n");
|
||||
return 0;
|
||||
}
|
||||
24
developer/debug/test/exec/crashtest_zerodiv.c
Normal file
24
developer/debug/test/exec/crashtest_zerodiv.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2025, The AROS Development Team. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
void crashfunc()
|
||||
{
|
||||
volatile int x = 1;
|
||||
volatile int y = 0;
|
||||
PutStr("Before crash\n");
|
||||
volatile int z = x / y;
|
||||
PutStr("After crash\n");
|
||||
(void)z;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
PutStr("main() enter\n");
|
||||
crashfunc();
|
||||
PutStr("main() exit\n");
|
||||
return 0;
|
||||
}
|
||||
24
developer/debug/test/exec/crashtest_zerodivfloat.c
Normal file
24
developer/debug/test/exec/crashtest_zerodivfloat.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2025, The AROS Development Team. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
void crashfunc()
|
||||
{
|
||||
volatile double x = 1.0;
|
||||
volatile double y = 0.0;
|
||||
PutStr("Before crash\n");
|
||||
volatile double z = x / y;
|
||||
PutStr("After crash\n");
|
||||
(void)z;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
PutStr("main() enter\n");
|
||||
crashfunc();
|
||||
PutStr("main() exit\n");
|
||||
return 0;
|
||||
}
|
||||
@ -16,7 +16,6 @@ EXECPUBLICFILES := \
|
||||
childstatus \
|
||||
childwait \
|
||||
copymem \
|
||||
crashtest \
|
||||
dumpmem \
|
||||
enqueue \
|
||||
exceptiontest \
|
||||
@ -37,6 +36,14 @@ EXECPUBLICFILES := \
|
||||
traptest \
|
||||
vblank
|
||||
|
||||
EXECPUBLICFILES += \
|
||||
crashtest_highpagefault \
|
||||
crashtest_illegalins \
|
||||
crashtest_pagefault \
|
||||
crashtest_unaligned \
|
||||
crashtest_zerodiv \
|
||||
crashtest_zerodivfloat
|
||||
|
||||
CUNITEXECTESTFILES := \
|
||||
cunit-exec-types
|
||||
|
||||
|
||||
Reference in New Issue
Block a user