aboutsummaryrefslogtreecommitdiff
path: root/src/common/mac
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-09-14 01:02:55 +0000
committerthestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-09-14 01:02:55 +0000
commit8d54c7509234e9a4918046c12dcb138489f06990 (patch)
tree3da356f2f0b5d4b281cb6394a8064fbee5fdd756 /src/common/mac
parentRemove javascript_engine GYP variable. (diff)
downloadbreakpad-8d54c7509234e9a4918046c12dcb138489f06990.tar.xz
Linux/Mac: Add option to omit the CFI section in dump_syms.
Review URL: http://breakpad.appspot.com/304001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@835 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/mac')
-rw-r--r--src/common/mac/dump_syms.h24
-rw-r--r--src/common/mac/dump_syms.mm48
2 files changed, 36 insertions, 36 deletions
diff --git a/src/common/mac/dump_syms.h b/src/common/mac/dump_syms.h
index f197ca28..0e2f464d 100644
--- a/src/common/mac/dump_syms.h
+++ b/src/common/mac/dump_syms.h
@@ -1,6 +1,6 @@
// -*- mode: c++ -*-
-// Copyright (c) 2010, Google Inc.
+// Copyright (c) 2011, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -52,9 +52,9 @@ namespace google_breakpad {
class DumpSymbols {
public:
- DumpSymbols()
+ DumpSymbols()
: input_pathname_(),
- object_filename_(),
+ object_filename_(),
contents_(),
selected_object_file_(),
selected_object_name_() { }
@@ -84,9 +84,9 @@ class DumpSymbols {
// object file, then the dumper will dump the object file whose
// architecture matches that of this dumper program.
bool SetArchitecture(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype);
-
- // If this dumper's file includes an object file for |arch_name|, then select
- // that object file for dumping, and return true. Otherwise, return false,
+
+ // If this dumper's file includes an object file for |arch_name|, then select
+ // that object file for dumping, and return true. Otherwise, return false,
// and leave this dumper's selected architecture unchanged.
//
// By default, if this dumper's file contains only one object file, then
@@ -94,7 +94,7 @@ class DumpSymbols {
// object file, then the dumper will dump the object file whose
// architecture matches that of this dumper program.
bool SetArchitecture(const std::string &arch_name);
-
+
// Return a pointer to an array of 'struct fat_arch' structures,
// describing the object files contained in this dumper's file. Set
// *|count| to the number of elements in the array. The returned array is
@@ -109,10 +109,10 @@ class DumpSymbols {
return NULL;
}
- // Read the selected object file's debugging information, and write it
- // out to |stream|. Return true on success; if an error occurs, report it
- // and return false.
- bool WriteSymbolFile(std::ostream &stream);
+ // Read the selected object file's debugging information, and write it out to
+ // |stream|. Write the CFI section if |cfi| is true. Return true on success;
+ // if an error occurs, report it and return false.
+ bool WriteSymbolFile(std::ostream &stream, bool cfi);
private:
// Used internally.
@@ -158,7 +158,7 @@ class DumpSymbols {
// has exactly one element.
vector<struct fat_arch> object_files_;
- // The object file in object_files_ selected to dump, or NULL if
+ // The object file in object_files_ selected to dump, or NULL if
// SetArchitecture hasn't been called yet.
const struct fat_arch *selected_object_file_;
diff --git a/src/common/mac/dump_syms.mm b/src/common/mac/dump_syms.mm
index 5fd614f2..9783514f 100644
--- a/src/common/mac/dump_syms.mm
+++ b/src/common/mac/dump_syms.mm
@@ -1,6 +1,6 @@
// -*- mode: c++ -*-
-// Copyright (c) 2010, Google Inc.
+// Copyright (c) 2011, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -79,7 +79,7 @@ namespace google_breakpad {
bool DumpSymbols::Read(NSString *filename) {
if (![[NSFileManager defaultManager] fileExistsAtPath:filename]) {
fprintf(stderr, "Object file does not exist: %s\n",
- [filename fileSystemRepresentation]);
+ [filename fileSystemRepresentation]);
return false;
}
@@ -101,15 +101,15 @@ bool DumpSymbols::Read(NSString *filename) {
// pathForResource:ofType:inDirectory likes.
NSString *base_name = [input_pathname_ lastPathComponent];
NSString *dwarf_resource;
-
+
do {
NSString *new_base_name = [base_name stringByDeletingPathExtension];
// If stringByDeletingPathExtension returned the name unchanged, then
// there's nothing more for us to strip off --- lose.
if ([new_base_name isEqualToString:base_name]) {
- fprintf(stderr, "Unable to find DWARF-bearing file in bundle: %s\n",
- [input_pathname_ fileSystemRepresentation]);
+ fprintf(stderr, "Unable to find DWARF-bearing file in bundle: %s\n",
+ [input_pathname_ fileSystemRepresentation]);
return false;
}
@@ -141,12 +141,12 @@ bool DumpSymbols::Read(NSString *filename) {
// file don't affect memory and vice versa).
NSError *error;
contents_ = [NSData dataWithContentsOfFile:object_filename_
- options:0
- error:&error];
+ options:0
+ error:&error];
if (!contents_) {
fprintf(stderr, "Error reading object file: %s: %s\n",
- [object_filename_ fileSystemRepresentation],
- [[error localizedDescription] UTF8String]);
+ [object_filename_ fileSystemRepresentation],
+ [[error localizedDescription] UTF8String]);
return false;
}
[contents_ retain];
@@ -166,7 +166,7 @@ bool DumpSymbols::Read(NSString *filename) {
fat_reader.object_files(&object_files_count);
if (object_files_count == 0) {
fprintf(stderr, "Fat binary file contains *no* architectures: %s\n",
- [object_filename_ fileSystemRepresentation]);
+ [object_filename_ fileSystemRepresentation]);
return false;
}
object_files_.resize(object_files_count);
@@ -197,14 +197,14 @@ bool DumpSymbols::SetArchitecture(const std::string &arch_name) {
}
return arch_set;
}
-
+
string DumpSymbols::Identifier() {
FileID file_id([object_filename_ fileSystemRepresentation]);
unsigned char identifier_bytes[16];
cpu_type_t cpu_type = selected_object_file_->cputype;
if (!file_id.MachoIdentifier(cpu_type, identifier_bytes)) {
fprintf(stderr, "Unable to calculate UUID of mach-o binary %s!\n",
- [object_filename_ fileSystemRepresentation]);
+ [object_filename_ fileSystemRepresentation]);
return "";
}
@@ -243,7 +243,7 @@ bool DumpSymbols::ReadDwarf(google_breakpad::Module *module,
const mach_o::Reader &macho_reader,
const mach_o::SectionMap &dwarf_sections) const {
// Build a byte reader of the appropriate endianness.
- ByteReader byte_reader(macho_reader.big_endian()
+ ByteReader byte_reader(macho_reader.big_endian()
? dwarf2reader::ENDIANNESS_BIG
: dwarf2reader::ENDIANNESS_LITTLE);
@@ -265,10 +265,10 @@ bool DumpSymbols::ReadDwarf(google_breakpad::Module *module,
// There had better be a __debug_info section!
if (!debug_info_section.first) {
fprintf(stderr, "%s: __DWARF segment of file has no __debug_info section\n",
- selected_object_name_.c_str());
+ selected_object_name_.c_str());
return false;
}
-
+
// Build a line-to-module loader for the root handler to use.
DumperLineToModule line_to_module(&byte_reader);
@@ -343,7 +343,7 @@ bool DumpSymbols::ReadCFI(google_breakpad::Module *module,
// investigation, Mac OS X only uses DW_EH_PE_pcrel-based pointers, so
// this is the only base address the CFI parser will need.
byte_reader.SetCFIDataBase(section.address, cfi);
-
+
dwarf2reader::CallFrameInfo::Reporter dwarf_reporter(selected_object_name_,
section.section_name);
dwarf2reader::CallFrameInfo parser(cfi, cfi_size,
@@ -421,7 +421,7 @@ bool DumpSymbols::LoadCommandDumper::SymtabCommand(const ByteBuffer &entries,
return true;
}
-bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
+bool DumpSymbols::WriteSymbolFile(std::ostream &stream, bool cfi) {
// Select an object file, if SetArchitecture hasn't been called to set one
// explicitly.
if (!selected_object_file_) {
@@ -433,10 +433,10 @@ bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
const NXArchInfo *local_arch = NXGetLocalArchInfo();
if (!SetArchitecture(local_arch->cputype, local_arch->cpusubtype)) {
fprintf(stderr, "%s: object file contains more than one"
- " architecture, none of which match the current"
+ " architecture, none of which match the current"
" architecture; specify an architecture explicitly"
- " with '-a ARCH' to resolve the ambiguity\n",
- [object_filename_ fileSystemRepresentation]);
+ " with '-a ARCH' to resolve the ambiguity\n",
+ [object_filename_ fileSystemRepresentation]);
return false;
}
}
@@ -472,7 +472,7 @@ bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
identifier += "0";
// Create a module to hold the debugging information.
- Module module([module_name UTF8String], "mac", selected_arch_name,
+ Module module([module_name UTF8String], "mac", selected_arch_name,
identifier);
// Parse the selected object file.
@@ -481,8 +481,8 @@ bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
if (!reader.Read(reinterpret_cast<const uint8_t *>([contents_ bytes])
+ selected_object_file_->offset,
selected_object_file_->size,
- selected_object_file_->cputype,
- selected_object_file_->cpusubtype))
+ selected_object_file_->cputype,
+ selected_object_file_->cpusubtype))
return false;
// Walk its load commands, and deal with whatever is there.
@@ -490,7 +490,7 @@ bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
if (!reader.WalkLoadCommands(&load_command_dumper))
return false;
- return module.Write(stream);
+ return module.Write(stream, cfi);
}
} // namespace google_breakpad