toaruos/modules/crash.c

29 lines
546 B
C
Raw Normal View History

#include <module.h>
2014-04-13 11:51:50 +04:00
#include <printf.h>
#include <mod/shell.h>
DEFINE_SHELL_FUNCTION(crash, "Dereference NULL.") {
2014-04-13 11:51:50 +04:00
fprintf(tty, "*0x0 = %x\n", *((int *)0x00));
*((int *)0x0) = 0x42;
fprintf(tty, "*0x0 = %x\n", *((int *)0x00));
return 0;
}
DEFINE_SHELL_FUNCTION(assert_false, "assert(0)") {
assert(0);
return 0;
}
static int crash_init(void) {
BIND_SHELL_FUNCTION(crash);
BIND_SHELL_FUNCTION(assert_false);
2014-03-19 09:57:07 +04:00
return 0;
}
static int crash_fini(void) {
2014-03-19 09:57:07 +04:00
return 0;
}
MODULE_DEF(crash, crash_init, crash_fini);
2014-03-19 07:11:56 +04:00
MODULE_DEPENDS(debugshell);