Kimiyuki Onaka | b767cb1 | 2021-01-22 15:00:22 +0900 | [diff] [blame] | 1 | // 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 | |
| 12 | namespace kernel_util { |
| 13 | |
| 14 | // Enumeration to specify architecture type. |
| 15 | enum ArchKind { |
| 16 | kArchUnknown, |
| 17 | kArchArm, |
| 18 | kArchMips, |
| 19 | kArchX86, |
| 20 | kArchX86_64, |
| 21 | |
| 22 | kArchCount // Number of architectures. |
| 23 | }; |
| 24 | |
| 25 | extern const char kKernelExecName[]; |
| 26 | |
| 27 | // Returns the architecture kind for which we are built. |
| 28 | ArchKind GetCompilerArch(); |
| 29 | |
| 30 | // Compute a stack signature string from a kernel dump. |
| 31 | std::string ComputeKernelStackSignature(const std::string& kernel_dump, |
| 32 | ArchKind arch); |
| 33 | |
| 34 | // BIOS crashes use a simple signature containing the crash PC. |
| 35 | std::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 ']'). |
| 39 | std::string WatchdogSignature(const std::string& console_ramoops); |
| 40 | |
| 41 | } // namespace kernel_util |
| 42 | |
| 43 | #endif // CRASH_REPORTER_KERNEL_UTIL_H_ |