Add crash reason extraction to microdump processor

BUG=754715

Change-Id: I00fe62ed06dbbab4c8f6c416d56e2d444be11571
Reviewed-on: https://chromium-review.googlesource.com/621307
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Tobias Sargeant 2017-08-18 17:29:38 +01:00 committed by Tobias Sargeant
parent b1e7ec065d
commit 2b3be5179e
5 changed files with 1457 additions and 1 deletions

View file

@ -54,6 +54,7 @@ static const char kMicrodumpBegin[] = "-----BEGIN BREAKPAD MICRODUMP-----";
static const char kMicrodumpEnd[] = "-----END BREAKPAD MICRODUMP-----";
static const char kOsKey[] = ": O ";
static const char kCpuKey[] = ": C ";
static const char kCrashReasonKey[] = ": R ";
static const char kGpuKey[] = ": G ";
static const char kMmapKey[] = ": M ";
static const char kStackKey[] = ": S ";
@ -212,7 +213,9 @@ Microdump::Microdump(const string& contents)
: context_(new MicrodumpContext()),
stack_region_(new MicrodumpMemoryRegion()),
modules_(new MicrodumpModules()),
system_info_(new SystemInfo()) {
system_info_(new SystemInfo()),
crash_reason_(),
crash_address_(0u) {
assert(!contents.empty());
bool in_microdump = false;
@ -350,6 +353,15 @@ Microdump::Microdump(const string& contents)
} else {
std::cerr << "Unsupported architecture: " << arch << std::endl;
}
} else if ((pos = line.find(kCrashReasonKey)) != string::npos) {
string crash_reason_str(line, pos + strlen(kCrashReasonKey));
std::istringstream crash_reason_tokens(crash_reason_str);
string signal;
string address;
crash_reason_tokens >> signal;
crash_reason_tokens >> crash_reason_;
crash_reason_tokens >> address;
crash_address_ = HexStrToL<uint64_t>(address);
} else if ((pos = line.find(kGpuKey)) != string::npos) {
string gpu_str(line, pos + strlen(kGpuKey));
if (strcmp(gpu_str.c_str(), kGpuUnknown) != 0) {