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

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: 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
Index: src/processor/microdump.cc
diff --git a/src/processor/microdump.cc b/src/processor/microdump.cc
index 1043c482adc3fca90860aadeceaca9130763d5bf..c3b4f1639c830190bd4419b6cd1ab344792069ec 100644
--- a/src/processor/microdump.cc
+++ b/src/processor/microdump.cc
@@ -61,8 +61,11 @@ 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";
+
Primiano Tucci (use gerrit) 2016/02/25 01:08:07 nit: spurious extra line?
mveljko 2016/02/25 09:29:50 Done. Removed it.
template<typename T>
T HexStrToL(const string& str) {
uint64_t res = 0;
@@ -131,6 +134,16 @@ void MicrodumpContext::SetContextX86(MDRawContextX86* x86) {
valid_ = true;
}
+void MicrodumpContext::SetContextMIPS(MDRawContextMIPS* mips, bool arch64) {
vapier 2016/02/24 22:35:43 i haven't looked closely, but why do we need these
mveljko 2016/02/25 09:29:51 I don't know really why, maybe so that the code wo
+ if (arch64) {
+ DumpContext::SetContextFlags(MD_CONTEXT_MIPS64);
+ } else {
+ DumpContext::SetContextFlags(MD_CONTEXT_MIPS);
+ }
+ DumpContext::SetContextMIPS(mips);
+ valid_ = true;
+}
+
//
// MicrodumpMemoryRegion
@@ -307,6 +320,17 @@ Microdump::Microdump(const string& contents)
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 ||
+ strcmp(arch.c_str(), kMips64Architecture) == 0) {
vapier 2016/02/24 22:35:43 indentation looks off here
mveljko 2016/02/25 09:29:50 Fixed this when I separated the functions.
+ if (cpu_state_raw.size() != sizeof(MDRawContextMIPS)) {
+ std::cerr << "Malformed CPU context. Got " << cpu_state_raw.size() <<
+ " bytes instead of " << sizeof(MDRawContextMIPS) << std::endl;
vapier 2016/02/24 22:35:43 indentation looks off here
mveljko 2016/02/25 09:29:50 I checked the if branches for arm/arm64/x86 and th
vapier 2016/02/25 16:15:44 this looks like the only file that wraps cout/cerr
mveljko 2016/02/25 16:35:25 So should I fix this in the whole file or just MIP
Primiano Tucci (use gerrit) 2016/02/25 17:00:15 Fix also the others. I think it's easier if you ru
mveljko 2016/02/26 10:43:54 I ran the file through clang-format and the result
+ continue;
+ }
+ MDRawContextMIPS* mips = new MDRawContextMIPS();
+ memcpy(mips, &cpu_state_raw[0], cpu_state_raw.size());
+ context_->SetContextMIPS(mips,
+ strcmp(arch.c_str(), kMips64Architecture)? false:true);
} else {
std::cerr << "Unsupported architecture: " << arch << std::endl;
}

Powered by Google App Engine
This is Rietveld 408576698