2014-03-17 01:39:39 +04:00
|
|
|
#include <module.h>
|
2014-04-13 11:51:50 +04:00
|
|
|
#include <printf.h>
|
2014-03-17 01:39:39 +04:00
|
|
|
#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;
|
2014-03-17 01:39:39 +04:00
|
|
|
}
|
|
|
|
|
2014-05-11 01:16:35 +04:00
|
|
|
DEFINE_SHELL_FUNCTION(assert_false, "assert(0)") {
|
|
|
|
assert(0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-03-17 01:39:39 +04:00
|
|
|
static int crash_init(void) {
|
|
|
|
BIND_SHELL_FUNCTION(crash);
|
2014-05-11 01:16:35 +04:00
|
|
|
BIND_SHELL_FUNCTION(assert_false);
|
2014-03-19 09:57:07 +04:00
|
|
|
return 0;
|
2014-03-17 01:39:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int crash_fini(void) {
|
2014-03-19 09:57:07 +04:00
|
|
|
return 0;
|
2014-03-17 01:39:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
MODULE_DEF(crash, crash_init, crash_fini);
|
2014-03-19 07:11:56 +04:00
|
|
|
MODULE_DEPENDS(debugshell);
|