From f690be1e8388569bcfb76efd90752426a3824dd9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 22 Jan 2016 06:45:28 +1030 Subject: [PATCH] daemon: dev-crash command. Causes us to dump in crash.log. Signed-off-by: Rusty Russell --- daemon/jsonrpc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/daemon/jsonrpc.c b/daemon/jsonrpc.c index bca0b1482..d0944b8f3 100644 --- a/daemon/jsonrpc.c +++ b/daemon/jsonrpc.c @@ -232,6 +232,19 @@ static const struct json_command rhash_command = { "Returns a hash value" }; +static void json_crash(struct command *cmd, + const char *buffer, const jsmntok_t *params) +{ + fatal("Crash at user request"); +} + +static const struct json_command crash_command = { + "dev-crash", + json_crash, + "Call fatal().", + "Simple crash test for developers" +}; + static const struct json_command *cmdlist[] = { &help_command, &stop_command, @@ -244,7 +257,8 @@ static const struct json_command *cmdlist[] = { /* Developer/debugging options. */ &echo_command, &rhash_command, - &mocktime_command + &mocktime_command, + &crash_command }; static void json_help(struct command *cmd,