From 853bb80e58fa8f6cea6bead5cc36370a3fe8901e Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Fri, 16 Mar 2018 08:44:56 -0700 Subject: [PATCH] bootstat: 3.18 kernel does not report "SysRq : Trigger a crash" Use an alternate means to determine that the sysrq crash was requested. Also, to be CTS compliant, the kernel_panic subreason must be in lower case. Test: boot_reason_test.sh Bug: 74595769 Bug: 63736262 Change-Id: Ica06960ce62d220a909006e365951376d672b7e6 --- bootstat/bootstat.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index a1fe6ed4b..dfc46ea61 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -191,7 +192,9 @@ const std::map kBootReasonMap = { {"s3_wakeup", 51}, {"kernel_panic,sysrq", 52}, {"kernel_panic,NULL", 53}, + {"kernel_panic,null", 53}, {"kernel_panic,BUG", 54}, + {"kernel_panic,bug", 54}, {"bootloader", 55}, {"cold", 56}, {"hard", 57}, @@ -485,18 +488,19 @@ bool correctForBer(std::string& reason, const std::string& needle) { bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { // 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. ret = "kernel_panic,sysrq"; return true; } if (console.rfind("Unable to handle kernel NULL pointer dereference at virtual address") != std::string::npos) { - ret = "kernel_panic,NULL"; + ret = "kernel_panic,null"; return true; } if (console.rfind("Kernel BUG at ") != std::string::npos) { - ret = "kernel_panic,BUG"; + ret = "kernel_panic,bug"; return true; } return false;