diff options
author | Aaron Odell <aaronodell@google.com> | 2023-04-04 21:05:57 -0700 |
---|---|---|
committer | Travis Geiselbrecht <geist@foobox.com> | 2023-04-23 17:34:57 -0700 |
commit | 8fc673fe4a7a5d9f28077e6353621cf99fa6fd62 (patch) | |
tree | b171101d084118166fac68ed51c2691fdde43b89 | |
parent | 9ba1f165cdf947e443431a999d1943dbb94ba48e (diff) | |
download | lk-8fc673fe4a7a5d9f28077e6353621cf99fa6fd62.tar.gz |
[lib][debugcommands] Add panic command
Add a simple command to generate a test panic.
-rw-r--r-- | lib/debugcommands/debugcommands.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/debugcommands/debugcommands.c b/lib/debugcommands/debugcommands.c index a79c8e64..4deffb3f 100644 --- a/lib/debugcommands/debugcommands.c +++ b/lib/debugcommands/debugcommands.c @@ -35,6 +35,7 @@ static int cmd_sleep(int argc, const console_cmd_args *argv); static int cmd_time(int argc, const console_cmd_args *argv); static int cmd_timeh(int argc, const console_cmd_args *argv); static int cmd_crash(int argc, const console_cmd_args *argv); +static int cmd_panic(int argc, const console_cmd_args *argv); static int cmd_stackstomp(int argc, const console_cmd_args *argv); STATIC_COMMAND_START @@ -50,6 +51,7 @@ STATIC_COMMAND_MASKED("fh", "fill range of memory by halfword", &cmd_fill_mem, C STATIC_COMMAND_MASKED("fb", "fill range of memory by byte", &cmd_fill_mem, CMD_AVAIL_ALWAYS) STATIC_COMMAND_MASKED("mc", "copy a range of memory", &cmd_copy_mem, CMD_AVAIL_ALWAYS) STATIC_COMMAND("crash", "intentionally crash", &cmd_crash) +STATIC_COMMAND("panic", "intentionally panic", &cmd_panic) STATIC_COMMAND("stackstomp", "intentionally overrun the stack", &cmd_stackstomp) #endif #if LK_DEBUGLEVEL > 1 @@ -387,6 +389,11 @@ static int cmd_crash(int argc, const console_cmd_args *argv) { } #pragma GCC diagnostic pop +static int cmd_panic(int argc, const console_cmd_args *argv) { + panic("Test panic\n"); + return 0; +} + static int cmd_stackstomp(int argc, const console_cmd_args *argv) { for (size_t i = 0; i < DEFAULT_STACK_SIZE * 2; i++) { uint8_t death[i]; |