Support processing microdumps for x86 architecture.

BUG=587536
R=primiano@chromium.org

Review URL: https://codereview.chromium.org/1704243002 .
This commit is contained in:
Maria Mandlis 2016-02-18 06:13:56 -08:00
parent 25f913e981
commit f97e47e55e
4 changed files with 216 additions and 6 deletions

View file

@ -60,6 +60,7 @@ static const char kStackKey[] = ": S ";
static const char kStackFirstLineKey[] = ": S 0 ";
static const char kArmArchitecture[] = "arm";
static const char kArm64Architecture[] = "arm64";
static const char kX86Architecture[] = "x86";
static const char kGpuUnknown[] = "UNKNOWN";
template<typename T>
@ -124,6 +125,12 @@ void MicrodumpContext::SetContextARM64(MDRawContextARM64* arm64) {
valid_ = true;
}
void MicrodumpContext::SetContextX86(MDRawContextX86* x86) {
DumpContext::SetContextFlags(MD_CONTEXT_X86);
DumpContext::SetContextX86(x86);
valid_ = true;
}
//
// MicrodumpMemoryRegion
@ -291,6 +298,15 @@ Microdump::Microdump(const string& contents)
MDRawContextARM64* arm = new MDRawContextARM64();
memcpy(arm, &cpu_state_raw[0], cpu_state_raw.size());
context_->SetContextARM64(arm);
} else if (strcmp(arch.c_str(), kX86Architecture) == 0) {
if (cpu_state_raw.size() != sizeof(MDRawContextX86)) {
std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size() <<
" bytes instead of " << sizeof(MDRawContextX86) << std::endl;
continue;
}
MDRawContextX86* x86 = new MDRawContextX86();
memcpy(x86, &cpu_state_raw[0], cpu_state_raw.size());
context_->SetContextX86(x86);
} else {
std::cerr << "Unsupported architecture: " << arch << std::endl;
}