aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorgordana.cmiljanovic@imgtec.com <gordana.cmiljanovic@imgtec.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-09-11 11:37:04 +0000
committergordana.cmiljanovic@imgtec.com <gordana.cmiljanovic@imgtec.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-09-11 11:37:04 +0000
commitf78839c15730533fc433c50ea83a3afea835c245 (patch)
tree9b3136dd94e663af23394356679b78467fddd5b7 /src/common
parentFixing minidump_dump to handle nacl dumps. (diff)
downloadbreakpad-f78839c15730533fc433c50ea83a3afea835c245.tar.xz
Adding support for mips.
Support for mips cpu is added to all breakapad targets including unittests. BUG=none TEST=unittests Review URL: https://breakpad.appspot.com/614002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1212 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common')
-rw-r--r--src/common/dwarf/dwarf2reader.cc15
-rw-r--r--src/common/dwarf_cfi_to_module.cc17
-rw-r--r--src/common/dwarf_cfi_to_module.h3
-rw-r--r--src/common/linux/dump_symbols.cc12
4 files changed, 38 insertions, 9 deletions
diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc
index f1a07f0b..a26143c7 100644
--- a/src/common/dwarf/dwarf2reader.cc
+++ b/src/common/dwarf/dwarf2reader.cc
@@ -1512,16 +1512,19 @@ bool CallFrameInfo::State::DoInstruction() {
// Change the base register used to compute the CFA.
case DW_CFA_def_cfa_register: {
+ if (!ParseOperands("r", &ops)) return false;
Rule *cfa_rule = rules_.CFARule();
if (!cfa_rule) {
- reporter_->NoCFARule(entry_->offset, entry_->kind, CursorOffset());
+ if (!DoDefCFA(ops.register_number, ops.offset)) {
+ reporter_->NoCFARule(entry_->offset, entry_->kind, CursorOffset());
+ return false;
+ }
+ } else {
+ cfa_rule->SetBaseRegister(ops.register_number);
+ if (!cfa_rule->Handle(handler_, address_,
+ Handler::kCFARegister))
return false;
}
- if (!ParseOperands("r", &ops)) return false;
- cfa_rule->SetBaseRegister(ops.register_number);
- if (!cfa_rule->Handle(handler_, address_,
- Handler::kCFARegister))
- return false;
break;
}
diff --git a/src/common/dwarf_cfi_to_module.cc b/src/common/dwarf_cfi_to_module.cc
index 15904d75..d0056f32 100644
--- a/src/common/dwarf_cfi_to_module.cc
+++ b/src/common/dwarf_cfi_to_module.cc
@@ -105,6 +105,23 @@ vector<string> DwarfCFIToModule::RegisterNames::ARM() {
return MakeVector(names, sizeof(names) / sizeof(names[0]));
}
+vector<string> DwarfCFIToModule::RegisterNames::MIPS() {
+ static const char* const kRegisterNames[] = {
+ "$zero", "$at", "$v0", "$v1", "$a0", "$a1", "$a2", "$a3",
+ "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7",
+ "$s0", "$s1", "$s2", "$s3", "$s4", "$s5", "$s6", "$s7",
+ "$t8", "$t9", "$k0", "$k1", "$gp", "$sp", "$fp", "$ra",
+ "$lo", "$hi", "$pc", "$f0", "$f2", "$f3", "$f4", "$f5",
+ "$f6", "$f7", "$f8", "$f9", "$f10", "$f11", "$f12", "$f13",
+ "$f14", "$f15", "$f16", "$f17", "$f18", "$f19", "$f20",
+ "$f21", "$f22", "$f23", "$f24", "$f25", "$f26", "$f27",
+ "$f28", "$f29", "$f30", "$f31", "$fcsr", "$fir"
+ };
+
+ return MakeVector(kRegisterNames,
+ sizeof(kRegisterNames) / sizeof(kRegisterNames[0]));
+}
+
bool DwarfCFIToModule::Entry(size_t offset, uint64 address, uint64 length,
uint8 version, const string &augmentation,
unsigned return_address) {
diff --git a/src/common/dwarf_cfi_to_module.h b/src/common/dwarf_cfi_to_module.h
index 7db552a6..d5a8b1cc 100644
--- a/src/common/dwarf_cfi_to_module.h
+++ b/src/common/dwarf_cfi_to_module.h
@@ -108,6 +108,9 @@ class DwarfCFIToModule: public CallFrameInfo::Handler {
// ARM.
static vector<string> ARM();
+
+ // MIPS.
+ static vector<string> MIPS();
private:
// Given STRINGS, an array of C strings with SIZE elements, return an
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index 014e7c3e..1f58d10f 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -291,6 +291,9 @@ bool DwarfCFIRegisterNames(const typename ElfClass::Ehdr* elf_header,
case EM_ARM:
*register_names = DwarfCFIToModule::RegisterNames::ARM();
return true;
+ case EM_MIPS:
+ *register_names = DwarfCFIToModule::RegisterNames::MIPS();
+ return true;
case EM_X86_64:
*register_names = DwarfCFIToModule::RegisterNames::X86_64();
return true;
@@ -534,6 +537,7 @@ bool LoadSymbols(const string& obj_file,
typedef typename ElfClass::Addr Addr;
typedef typename ElfClass::Phdr Phdr;
typedef typename ElfClass::Shdr Shdr;
+ typedef typename ElfClass::Word Word;
Addr loading_addr = GetLoadingAddress<ElfClass>(
GetOffset<ElfClass, Phdr>(elf_header, elf_header->e_phoff),
@@ -541,6 +545,8 @@ bool LoadSymbols(const string& obj_file,
module->SetLoadAddress(loading_addr);
info->set_loading_addr(loading_addr, obj_file);
+ Word debug_section_type =
+ elf_header->e_machine == EM_MIPS ? SHT_MIPS_DWARF : SHT_PROGBITS;
const Shdr* sections =
GetOffset<ElfClass, Shdr>(elf_header, elf_header->e_shoff);
const Shdr* section_names = sections + elf_header->e_shstrndx;
@@ -574,7 +580,7 @@ bool LoadSymbols(const string& obj_file,
// Look for DWARF debugging information, and load it if present.
const Shdr* dwarf_section =
- FindElfSectionByName<ElfClass>(".debug_info", SHT_PROGBITS,
+ FindElfSectionByName<ElfClass>(".debug_info", debug_section_type,
sections, names, names_end,
elf_header->e_shnum);
if (dwarf_section) {
@@ -593,7 +599,7 @@ bool LoadSymbols(const string& obj_file,
// Dwarf Call Frame Information (CFI) is actually independent from
// the other DWARF debugging information, and can be used alone.
const Shdr* dwarf_cfi_section =
- FindElfSectionByName<ElfClass>(".debug_frame", SHT_PROGBITS,
+ FindElfSectionByName<ElfClass>(".debug_frame", debug_section_type,
sections, names, names_end,
elf_header->e_shnum);
if (dwarf_cfi_section) {
@@ -611,7 +617,7 @@ bool LoadSymbols(const string& obj_file,
// Linux C++ exception handling information can also provide
// unwinding data.
const Shdr* eh_frame_section =
- FindElfSectionByName<ElfClass>(".eh_frame", SHT_PROGBITS,
+ FindElfSectionByName<ElfClass>(".eh_frame", debug_section_type,
sections, names, names_end,
elf_header->e_shnum);
if (eh_frame_section) {