blob: fd4341d6a158799ce231ec66ba4c81540c832883 [file] [log] [blame]
Kimiyuki Onakab767cb12021-01-22 15:00:22 +09001// Copyright 2021 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CRASH_REPORTER_KERNEL_UTIL_H_
6#define CRASH_REPORTER_KERNEL_UTIL_H_
7
8#include <string>
9
10#include "crash-reporter/crash_collector.h"
11
12namespace kernel_util {
13
14// Enumeration to specify architecture type.
15enum ArchKind {
16 kArchUnknown,
17 kArchArm,
18 kArchMips,
19 kArchX86,
20 kArchX86_64,
21
22 kArchCount // Number of architectures.
23};
24
25extern const char kKernelExecName[];
26
27// Returns the architecture kind for which we are built.
28ArchKind GetCompilerArch();
29
30// Compute a stack signature string from a kernel dump.
31std::string ComputeKernelStackSignature(const std::string& kernel_dump,
32 ArchKind arch);
33
34// BIOS crashes use a simple signature containing the crash PC.
35std::string BiosCrashSignature(const std::string& dump);
36
37// Watchdog reboots leave no stack trace. Generate a poor man's signature out
38// of the last log line instead (minus the timestamp ended by ']').
39std::string WatchdogSignature(const std::string& console_ramoops);
40
41} // namespace kernel_util
42
43#endif // CRASH_REPORTER_KERNEL_UTIL_H_