diff options
author | Bill Richardson <wfrichar@chromium.org> | 2016-08-03 10:12:39 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-05 11:45:24 -0700 |
commit | cef1e7fa9a1b3a098994afcdcab0143dea890047 (patch) | |
tree | b0fec272d64d6964232fad3561c08760d3dd1338 /common/panic_output.c | |
parent | 2ea846e44ba9022584e6c6e88dab7961e77685d0 (diff) | |
download | chrome-ec-cef1e7fa9a1b3a098994afcdcab0143dea890047.tar.gz |
Add new "hang" option to crash command
The crash command is used to intentionally invoke various failure
modes in a running system. This adds one more (and cleans up the
command slightly). The "crash hang" command does the same thing
as "crash watchdog", except that it disables interrupts first.
Some SoCs may require special handling to recover from that case.
BUG=none
BRANCH=none
TEST=make buildall; run on Cr50 hardware
Invoked all the options to the crash command, observed that the
appropriate response occurred in each case (a stack trace if
possible, followed by a reboot).
Change-Id: I18897cfc04726e6aeda59f4c6e742d7a0037cf80
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/366127
Reviewed-by: Vadim Bendebury <vbendeb@google.com>
Diffstat (limited to 'common/panic_output.c')
-rw-r--r-- | common/panic_output.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/common/panic_output.c b/common/panic_output.c index 42dc72515c..ec80d6f4e9 100644 --- a/common/panic_output.c +++ b/common/panic_output.c @@ -166,10 +166,12 @@ static int command_crash(int argc, char **argv) int zero = 0; cflush(); - if (argc >= 3 && !strcasecmp(argv[2], "unsigned")) - ccprintf("%08x", (unsigned long)1 / zero); - else - ccprintf("%08x", (long)1 / zero); + ccprintf("%08x", (long)1 / zero); + } else if (!strcasecmp(argv[1], "udivzero")) { + int zero = 0; + + cflush(); + ccprintf("%08x", (unsigned long)1 / zero); #ifdef CONFIG_CMD_STACKOVERFLOW } else if (!strcasecmp(argv[1], "stack")) { stack_overflow_recurse(1); @@ -180,6 +182,10 @@ static int command_crash(int argc, char **argv) } else if (!strcasecmp(argv[1], "watchdog")) { while (1) ; + } else if (!strcasecmp(argv[1], "hang")) { + interrupt_disable(); + while (1) + ; } else { return EC_ERROR_PARAM1; } @@ -188,7 +194,11 @@ static int command_crash(int argc, char **argv) return EC_ERROR_UNKNOWN; } DECLARE_CONSOLE_COMMAND(crash, command_crash, - "[assert | divzero | stack | unaligned | watchdog] [options]", + "[assert | divzero | udivzero" +#ifdef CONFIG_CMD_STACKOVERFLOW + " | stack" +#endif + " | unaligned | watchdog | hang]", "Crash the system (for testing)", NULL); #endif |