mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-01 20:24:40 +01:00
Support processing microdump for mips architecture
Based on changes for ARM, ARM64 and X86, the support for MIPS and MIPS64 is added in microdump. TEST=microdump_stackwalk ~/microdump-mips32.dmp symbols/ BUG=microdump_stackwalk failing for mips architectures Review URL: https://codereview.chromium.org/1731923002/
This commit is contained in:
parent
d9c532217e
commit
6ce752d741
7 changed files with 254 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue