aboutsummaryrefslogtreecommitdiff
path: root/src/common/mac/dump_syms.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/mac/dump_syms.mm')
-rw-r--r--src/common/mac/dump_syms.mm36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/common/mac/dump_syms.mm b/src/common/mac/dump_syms.mm
index e26b05ea..f1aab426 100644
--- a/src/common/mac/dump_syms.mm
+++ b/src/common/mac/dump_syms.mm
@@ -55,6 +55,7 @@
#include "common/module.h"
#include "common/stabs_reader.h"
#include "common/stabs_to_module.h"
+#include "common/symbol_data.h"
#ifndef CPU_TYPE_ARM
#define CPU_TYPE_ARM (static_cast<cpu_type_t>(12))
@@ -370,8 +371,12 @@ class DumpSymbols::LoadCommandDumper:
// file, and adding data to MODULE.
LoadCommandDumper(const DumpSymbols &dumper,
google_breakpad::Module *module,
- const mach_o::Reader &reader)
- : dumper_(dumper), module_(module), reader_(reader) { }
+ const mach_o::Reader &reader,
+ SymbolData symbol_data)
+ : dumper_(dumper),
+ module_(module),
+ reader_(reader),
+ symbol_data_(symbol_data) { }
bool SegmentCommand(const mach_o::Segment &segment);
bool SymtabCommand(const ByteBuffer &entries, const ByteBuffer &strings);
@@ -380,6 +385,7 @@ class DumpSymbols::LoadCommandDumper:
const DumpSymbols &dumper_;
google_breakpad::Module *module_; // WEAK
const mach_o::Reader &reader_;
+ const SymbolData symbol_data_;
};
bool DumpSymbols::LoadCommandDumper::SegmentCommand(const Segment &segment) {
@@ -387,7 +393,7 @@ bool DumpSymbols::LoadCommandDumper::SegmentCommand(const Segment &segment) {
if (!reader_.MapSegmentSections(segment, &section_map))
return false;
- if (segment.name == "__TEXT") {
+ if (segment.name == "__TEXT" && symbol_data_ != NO_CFI) {
module_->SetLoadAddress(segment.vmaddr);
mach_o::SectionMap::const_iterator eh_frame =
section_map.find("__eh_frame");
@@ -399,13 +405,17 @@ bool DumpSymbols::LoadCommandDumper::SegmentCommand(const Segment &segment) {
}
if (segment.name == "__DWARF") {
- if (!dumper_.ReadDwarf(module_, reader_, section_map))
- return false;
- mach_o::SectionMap::const_iterator debug_frame
- = section_map.find("__debug_frame");
- if (debug_frame != section_map.end()) {
- // If there is a problem reading this, don't treat it as a fatal error.
- dumper_.ReadCFI(module_, reader_, debug_frame->second, false);
+ if (symbol_data_ != ONLY_CFI) {
+ if (!dumper_.ReadDwarf(module_, reader_, section_map))
+ return false;
+ }
+ if (symbol_data_ != NO_CFI) {
+ mach_o::SectionMap::const_iterator debug_frame
+ = section_map.find("__debug_frame");
+ if (debug_frame != section_map.end()) {
+ // If there is a problem reading this, don't treat it as a fatal error.
+ dumper_.ReadCFI(module_, reader_, debug_frame->second, false);
+ }
}
}
@@ -429,7 +439,7 @@ bool DumpSymbols::LoadCommandDumper::SymtabCommand(const ByteBuffer &entries,
return true;
}
-bool DumpSymbols::WriteSymbolFile(std::ostream &stream, bool cfi) {
+bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
// Select an object file, if SetArchitecture hasn't been called to set one
// explicitly.
if (!selected_object_file_) {
@@ -494,11 +504,11 @@ bool DumpSymbols::WriteSymbolFile(std::ostream &stream, bool cfi) {
return false;
// Walk its load commands, and deal with whatever is there.
- LoadCommandDumper load_command_dumper(*this, &module, reader);
+ LoadCommandDumper load_command_dumper(*this, &module, reader, symbol_data_);
if (!reader.WalkLoadCommands(&load_command_dumper))
return false;
- return module.Write(stream, cfi);
+ return module.Write(stream, symbol_data_);
}
} // namespace google_breakpad