Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: src/processor/microdump.cc

Issue 1704243002: Support processing microdumps for x86 architecture. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Add the testdata file. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/google_breakpad/processor/microdump.h ('k') | src/processor/microdump_processor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/processor/microdump.cc
diff --git a/src/processor/microdump.cc b/src/processor/microdump.cc
index e276743f0fedcb006c6df8b8cb5840e3638bdb96..1043c482adc3fca90860aadeceaca9130763d5bf 100644
--- a/src/processor/microdump.cc
+++ b/src/processor/microdump.cc
@@ -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;
}
« no previous file with comments | « src/google_breakpad/processor/microdump.h ('k') | src/processor/microdump_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698