2014-06-08 10:51:01 +04:00
|
|
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
2014-06-08 10:58:31 +04:00
|
|
|
* This file is part of ToaruOS and is released under the terms
|
2014-06-08 10:13:29 +04:00
|
|
|
* of the NCSA / University of Illinois License - see LICENSE.md
|
|
|
|
* Copyright (C) 2014 Kevin Lange
|
|
|
|
*/
|
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);
|