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

Unified Diff: src/processor/microdump.cc

Issue 1731923002: Support processing microdump for mips architecture (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Reduced size of .sym files + rebase Created 4 years, 9 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 e3dececbe6b64a5734fe5edc5963bff971b1136b..06211e60bca2aa59b9d29847faed0ef99322e019 100644
--- a/src/processor/microdump.cc
+++ b/src/processor/microdump.cc
@@ -61,6 +61,8 @@ static const char kStackFirstLineKey[] = ": S 0 ";
static const char kArmArchitecture[] = "arm";
static const char kArm64Architecture[] = "arm64";
static const char kX86Architecture[] = "x86";
+static const char kMipsArchitecture[] = "mips";
+static const char kMips64Architecture[] = "mips64";
static const char kGpuUnknown[] = "UNKNOWN";
template<typename T>
@@ -131,6 +133,18 @@ void MicrodumpContext::SetContextX86(MDRawContextX86* x86) {
valid_ = true;
}
+void MicrodumpContext::SetContextMIPS(MDRawContextMIPS* mips) {
+ DumpContext::SetContextFlags(MD_CONTEXT_MIPS);
+ DumpContext::SetContextMIPS(mips);
+ valid_ = true;
+}
+
+void MicrodumpContext::SetContextMIPS64(MDRawContextMIPS* mips64) {
+ DumpContext::SetContextFlags(MD_CONTEXT_MIPS64);
+ DumpContext::SetContextMIPS(mips64);
+ valid_ = true;
+}
+
//
// MicrodumpMemoryRegion
@@ -281,8 +295,9 @@ Microdump::Microdump(const string& contents)
std::vector<uint8_t> cpu_state_raw = ParseHexBuf(cpu_state_str);
if (strcmp(arch.c_str(), kArmArchitecture) == 0) {
if (cpu_state_raw.size() != sizeof(MDRawContextARM)) {
- std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size() <<
- " bytes instead of " << sizeof(MDRawContextARM) << std::endl;
+ std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size()
+ << " bytes instead of " << sizeof(MDRawContextARM)
+ << std::endl;
continue;
}
MDRawContextARM* arm = new MDRawContextARM();
@@ -290,8 +305,9 @@ Microdump::Microdump(const string& contents)
context_->SetContextARM(arm);
} else if (strcmp(arch.c_str(), kArm64Architecture) == 0) {
if (cpu_state_raw.size() != sizeof(MDRawContextARM64)) {
- std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size() <<
- " bytes instead of " << sizeof(MDRawContextARM64) << std::endl;
+ std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size()
+ << " bytes instead of " << sizeof(MDRawContextARM64)
+ << std::endl;
continue;
}
MDRawContextARM64* arm = new MDRawContextARM64();
@@ -299,13 +315,34 @@ Microdump::Microdump(const string& contents)
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;
+ 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 if (strcmp(arch.c_str(), kMipsArchitecture) == 0) {
+ if (cpu_state_raw.size() != sizeof(MDRawContextMIPS)) {
+ std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size()
+ << " bytes instead of " << sizeof(MDRawContextMIPS)
+ << std::endl;
+ continue;
+ }
+ MDRawContextMIPS* mips = new MDRawContextMIPS();
+ memcpy(mips, &cpu_state_raw[0], cpu_state_raw.size());
+ context_->SetContextMIPS(mips);
+ } else if (strcmp(arch.c_str(), kMips64Architecture) == 0) {
+ if (cpu_state_raw.size() != sizeof(MDRawContextMIPS)) {
+ std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size()
+ << " bytes instead of " << sizeof(MDRawContextMIPS)
+ << std::endl;
+ continue;
+ }
+ MDRawContextMIPS* mips64 = new MDRawContextMIPS();
+ memcpy(mips64, &cpu_state_raw[0], cpu_state_raw.size());
+ context_->SetContextMIPS64(mips64);
} 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