1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-01 09:53:57 +02:00

* Updated breakpad to latest version.

This commit is contained in:
Christian Muehlhaeuser
2012-06-24 18:25:34 +02:00
parent 0a3a9a7e97
commit d3eb5c3f88
186 changed files with 9184 additions and 5835 deletions

View File

@@ -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