Merge "bootstat: 3.18 kernel does not report "SysRq : Trigger a crash""

am: 5e2b2681ef

Change-Id: I9c3ad26c9c1a385aa2fe5bb428af5ff5c2221e00
This commit is contained in:
Mark Salyzyn 2018-03-16 20:56:19 +00:00 committed by android-build-merger
commit a2b4750771

View file

@ -30,6 +30,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
#include <android-base/chrono_utils.h> #include <android-base/chrono_utils.h>
@ -191,7 +192,9 @@ const std::map<std::string, int32_t> kBootReasonMap = {
{"s3_wakeup", 51}, {"s3_wakeup", 51},
{"kernel_panic,sysrq", 52}, {"kernel_panic,sysrq", 52},
{"kernel_panic,NULL", 53}, {"kernel_panic,NULL", 53},
{"kernel_panic,null", 53},
{"kernel_panic,BUG", 54}, {"kernel_panic,BUG", 54},
{"kernel_panic,bug", 54},
{"bootloader", 55}, {"bootloader", 55},
{"cold", 56}, {"cold", 56},
{"hard", 57}, {"hard", 57},
@ -485,18 +488,19 @@ bool correctForBer(std::string& reason, const std::string& needle) {
bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) {
// Check for kernel panic types to refine information // Check for kernel panic types to refine information
if (console.rfind("SysRq : Trigger a crash") != std::string::npos) { if ((console.rfind("SysRq : Trigger a crash") != std::string::npos) ||
(console.rfind("PC is at sysrq_handle_crash+") != std::string::npos)) {
// Can not happen, except on userdebug, during testing/debugging. // Can not happen, except on userdebug, during testing/debugging.
ret = "kernel_panic,sysrq"; ret = "kernel_panic,sysrq";
return true; return true;
} }
if (console.rfind("Unable to handle kernel NULL pointer dereference at virtual address") != if (console.rfind("Unable to handle kernel NULL pointer dereference at virtual address") !=
std::string::npos) { std::string::npos) {
ret = "kernel_panic,NULL"; ret = "kernel_panic,null";
return true; return true;
} }
if (console.rfind("Kernel BUG at ") != std::string::npos) { if (console.rfind("Kernel BUG at ") != std::string::npos) {
ret = "kernel_panic,BUG"; ret = "kernel_panic,bug";
return true; return true;
} }
return false; return false;