summaryrefslogtreecommitdiff
path: root/util/ec_parse_panicinfo.c
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@google.com>2016-09-01 14:35:48 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-09-06 22:02:27 -0700
commit107cb0df63efb527a470553b0a4e6f1f1ab17eb6 (patch)
tree53d3db1cfb60445ef0da82df66ea81989f0e0497 /util/ec_parse_panicinfo.c
parent03a3f864796d02196de8419b3c12c78f425b946c (diff)
downloadchrome-ec-107cb0df63efb527a470553b0a4e6f1f1ab17eb6.tar.gz
util: Add ec_parse_panicinfo tool to parse binary panicinfo
To be able to parse binary panicinfo from feedback reports, we need a host tool: - Move panicinfo generic parsing functions to a separate C file - Create a new host utility to parse panicinfo BRANCH=none BUG=chromium:643062 TEST=base64 -d | ec_parse_panicinfo Change-Id: Idd8560a2894f270d0ab3a9f654c333135759e57f Reviewed-on: https://chromium-review.googlesource.com/379639 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util/ec_parse_panicinfo.c')
-rw-r--r--util/ec_parse_panicinfo.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/util/ec_parse_panicinfo.c b/util/ec_parse_panicinfo.c
new file mode 100644
index 0000000000..5db8ed2e05
--- /dev/null
+++ b/util/ec_parse_panicinfo.c
@@ -0,0 +1,22 @@
+/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Standalone utility to parse EC panicinfo.
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include "ec_panicinfo.h"
+
+int main(int argc, char *argv[])
+{
+ struct panic_data pdata;
+
+ if (fread(&pdata, sizeof(pdata), 1, stdin) != 1) {
+ fprintf(stderr, "Error reading panicinfo from stdin.\n");
+ return 1;
+ }
+
+ return parse_panic_info(&pdata) ? 1 : 0;
+}