diff --git a/developer/debug/test/exec/crashtest_highpagefault.c b/developer/debug/test/exec/crashtest_highpagefault.c new file mode 100644 index 0000000000..484ab183cc --- /dev/null +++ b/developer/debug/test/exec/crashtest_highpagefault.c @@ -0,0 +1,27 @@ +/* + Copyright (C) 2025, The AROS Development Team. All rights reserved. +*/ + +#include +#include + +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; +} diff --git a/developer/debug/test/exec/crashtest_illegalins.c b/developer/debug/test/exec/crashtest_illegalins.c new file mode 100644 index 0000000000..ebcef7660f --- /dev/null +++ b/developer/debug/test/exec/crashtest_illegalins.c @@ -0,0 +1,22 @@ +/* + Copyright (C) 2025, The AROS Development Team. All rights reserved. +*/ + +#include +#include + +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; +} diff --git a/developer/debug/test/exec/crashtest.c b/developer/debug/test/exec/crashtest_pagefault.c similarity index 80% rename from developer/debug/test/exec/crashtest.c rename to developer/debug/test/exec/crashtest_pagefault.c index 4dd9b4361d..0c56714338 100644 --- a/developer/debug/test/exec/crashtest.c +++ b/developer/debug/test/exec/crashtest_pagefault.c @@ -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 diff --git a/developer/debug/test/exec/crashtest_unaligned.c b/developer/debug/test/exec/crashtest_unaligned.c new file mode 100644 index 0000000000..57c1a2e8da --- /dev/null +++ b/developer/debug/test/exec/crashtest_unaligned.c @@ -0,0 +1,24 @@ +/* + Copyright (C) 2025, The AROS Development Team. All rights reserved. +*/ + +#include +#include + +/* 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; +} diff --git a/developer/debug/test/exec/crashtest_zerodiv.c b/developer/debug/test/exec/crashtest_zerodiv.c new file mode 100644 index 0000000000..66b01e9d76 --- /dev/null +++ b/developer/debug/test/exec/crashtest_zerodiv.c @@ -0,0 +1,24 @@ +/* + Copyright (C) 2025, The AROS Development Team. All rights reserved. +*/ + +#include +#include + +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; +} diff --git a/developer/debug/test/exec/crashtest_zerodivfloat.c b/developer/debug/test/exec/crashtest_zerodivfloat.c new file mode 100644 index 0000000000..d87c389f26 --- /dev/null +++ b/developer/debug/test/exec/crashtest_zerodivfloat.c @@ -0,0 +1,24 @@ +/* + Copyright (C) 2025, The AROS Development Team. All rights reserved. +*/ + +#include +#include + +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; +} diff --git a/developer/debug/test/exec/mmakefile.src b/developer/debug/test/exec/mmakefile.src index 79800cbe1c..f923ac0d51 100644 --- a/developer/debug/test/exec/mmakefile.src +++ b/developer/debug/test/exec/mmakefile.src @@ -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