mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-05 05:58:24 +01:00
Clean up build for 64 bit.
Fix up some broken mac projects. Consolidate project settings in xcconfig files. http://breakpad.appspot.com/130001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@627 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
786275e719
commit
4ac61acb3a
53 changed files with 1791 additions and 1084 deletions
|
|
@ -123,11 +123,11 @@ uint64 ByteReader::ReadEncodedPointer(const char *buffer,
|
|||
|
||||
// First, find the offset to START from the closest prior aligned
|
||||
// address.
|
||||
size_t skew = section_base_ & (AddressSize() - 1);
|
||||
uint64_t skew = section_base_ & (AddressSize() - 1);
|
||||
// Now find the offset from that aligned address to buffer.
|
||||
size_t offset = skew + (buffer - buffer_base_);
|
||||
uint64_t offset = skew + (buffer - buffer_base_);
|
||||
// Round up to the next boundary.
|
||||
size_t aligned = (offset + AddressSize() - 1) & -AddressSize();
|
||||
uint64_t aligned = (offset + AddressSize() - 1) & -AddressSize();
|
||||
// Convert back to a pointer.
|
||||
const char *aligned_buffer = buffer_base_ + (aligned - skew);
|
||||
// Finally, store the length and actually fetch the pointer.
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ void CompilationUnit::ReadAbbrevs() {
|
|||
while (1) {
|
||||
CompilationUnit::Abbrev abbrev;
|
||||
size_t len;
|
||||
const uint32 number = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
const uint64 number = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
|
||||
if (number == 0)
|
||||
break;
|
||||
|
|
@ -98,7 +98,7 @@ void CompilationUnit::ReadAbbrevs() {
|
|||
abbrevptr += len;
|
||||
|
||||
assert(abbrevptr < abbrev_start + abbrev_length);
|
||||
const uint32 tag = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
const uint64 tag = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
abbrevptr += len;
|
||||
abbrev.tag = static_cast<enum DwarfTag>(tag);
|
||||
|
||||
|
|
@ -109,11 +109,11 @@ void CompilationUnit::ReadAbbrevs() {
|
|||
assert(abbrevptr < abbrev_start + abbrev_length);
|
||||
|
||||
while (1) {
|
||||
const uint32 nametemp = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
const uint64 nametemp = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
abbrevptr += len;
|
||||
|
||||
assert(abbrevptr < abbrev_start + abbrev_length);
|
||||
const uint32 formtemp = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
const uint64 formtemp = reader_->ReadUnsignedLEB128(abbrevptr, &len);
|
||||
abbrevptr += len;
|
||||
if (nametemp == 0 && formtemp == 0)
|
||||
break;
|
||||
|
|
@ -515,7 +515,7 @@ void CompilationUnit::ProcessDIEs() {
|
|||
continue;
|
||||
}
|
||||
|
||||
const Abbrev& abbrev = abbrevs_->at(abbrev_num);
|
||||
const Abbrev& abbrev = abbrevs_->at(static_cast<size_t>(abbrev_num));
|
||||
const enum DwarfTag tag = abbrev.tag;
|
||||
if (!handler_->StartDIE(absolute_offset, tag, abbrev.attributes)) {
|
||||
dieptr = SkipDIE(dieptr, abbrev);
|
||||
|
|
@ -618,8 +618,8 @@ void LineInfo::ReadHeader() {
|
|||
|
||||
uint64 filelength = reader_->ReadUnsignedLEB128(lineptr, &len);
|
||||
lineptr += len;
|
||||
handler_->DefineFile(filename, fileindex, dirindex, mod_time,
|
||||
filelength);
|
||||
handler_->DefineFile(filename, fileindex, static_cast<uint32>(dirindex),
|
||||
mod_time, filelength);
|
||||
fileindex++;
|
||||
}
|
||||
}
|
||||
|
|
@ -649,7 +649,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
opcode -= header.opcode_base;
|
||||
const int64 advance_address = (opcode / header.line_range)
|
||||
* header.min_insn_length;
|
||||
const int64 advance_line = (opcode % header.line_range)
|
||||
const int32 advance_line = (opcode % header.line_range)
|
||||
+ header.line_base;
|
||||
|
||||
// Check if the lsm passes "pc". If so, mark it as passed.
|
||||
|
|
@ -689,7 +689,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
case DW_LNS_advance_line: {
|
||||
const int64 advance_line = reader->ReadSignedLEB128(start, &templen);
|
||||
oplen += templen;
|
||||
lsm->line_num += advance_line;
|
||||
lsm->line_num += static_cast<int32>(advance_line);
|
||||
|
||||
// With gcc 4.2.1, we can get the line_no here for the first time
|
||||
// since DW_LNS_advance_line is called after DW_LNE_set_address is
|
||||
|
|
@ -703,13 +703,13 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
case DW_LNS_set_file: {
|
||||
const uint64 fileno = reader->ReadUnsignedLEB128(start, &templen);
|
||||
oplen += templen;
|
||||
lsm->file_num = fileno;
|
||||
lsm->file_num = static_cast<uint32>(fileno);
|
||||
}
|
||||
break;
|
||||
case DW_LNS_set_column: {
|
||||
const uint64 colno = reader->ReadUnsignedLEB128(start, &templen);
|
||||
oplen += templen;
|
||||
lsm->column_num = colno;
|
||||
lsm->column_num = static_cast<uint32>(colno);
|
||||
}
|
||||
break;
|
||||
case DW_LNS_negate_stmt: {
|
||||
|
|
@ -748,7 +748,7 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
}
|
||||
break;
|
||||
case DW_LNS_extended_op: {
|
||||
const size_t extended_op_len = reader->ReadUnsignedLEB128(start,
|
||||
const uint64 extended_op_len = reader->ReadUnsignedLEB128(start,
|
||||
&templen);
|
||||
start += templen;
|
||||
oplen += templen + extended_op_len;
|
||||
|
|
@ -790,8 +790,8 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
oplen += templen;
|
||||
|
||||
if (handler) {
|
||||
handler->DefineFile(filename, -1, dirindex, mod_time,
|
||||
filelength);
|
||||
handler->DefineFile(filename, -1, static_cast<uint32>(dirindex),
|
||||
mod_time, filelength);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -803,7 +803,6 @@ bool LineInfo::ProcessOneOpcode(ByteReader* reader,
|
|||
// Ignore unknown opcode silently
|
||||
if (header.std_opcode_lengths) {
|
||||
for (int i = 0; i < (*header.std_opcode_lengths)[opcode]; i++) {
|
||||
size_t templen;
|
||||
reader->ReadUnsignedLEB128(start, &templen);
|
||||
start += templen;
|
||||
oplen += templen;
|
||||
|
|
@ -1940,7 +1939,7 @@ bool CallFrameInfo::ReadCIEFields(CIE *cie) {
|
|||
// If we have a 'z' augmentation string, find the augmentation data and
|
||||
// use the augmentation string to parse it.
|
||||
if (cie->has_z_augmentation) {
|
||||
size_t data_size = reader_->ReadUnsignedLEB128(cursor, &len);
|
||||
uint64_t data_size = reader_->ReadUnsignedLEB128(cursor, &len);
|
||||
if (size_t(cie->end - cursor) < len + data_size)
|
||||
return ReportIncomplete(cie);
|
||||
cursor += len;
|
||||
|
|
@ -2060,7 +2059,7 @@ bool CallFrameInfo::ReadFDEFields(FDE *fde) {
|
|||
// If the CIE has a 'z' augmentation string, then augmentation data
|
||||
// appears here.
|
||||
if (fde->cie->has_z_augmentation) {
|
||||
size_t data_size = reader_->ReadUnsignedLEB128(cursor, &size);
|
||||
uint64_t data_size = reader_->ReadUnsignedLEB128(cursor, &size);
|
||||
if (size_t(fde->end - cursor) < size + data_size)
|
||||
return ReportIncomplete(fde);
|
||||
cursor += size;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ class CompilationUnit {
|
|||
// The abbreviation tells how to read a DWARF2/3 DIE, and consist of a
|
||||
// tag and a list of attributes, as well as the data form of each attribute.
|
||||
struct Abbrev {
|
||||
uint32 number;
|
||||
uint64 number;
|
||||
enum DwarfTag tag;
|
||||
bool has_children;
|
||||
AttributeList attributes;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ struct LineStateMachine {
|
|||
|
||||
uint32 file_num;
|
||||
uint64 address;
|
||||
uint64 line_num;
|
||||
uint32 line_num;
|
||||
uint32 column_num;
|
||||
bool is_stmt; // stmt means statement.
|
||||
bool basic_block;
|
||||
|
|
|
|||
57
src/common/mac/Breakpad.xcconfig
Normal file
57
src/common/mac/Breakpad.xcconfig
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// Copyright (c) 2010, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
ARCHS = $(ARCHS_STANDARD_32_64_BIT)
|
||||
SDKROOT = macosx10.5
|
||||
SDKROOT[arch=i386] = macosx10.4
|
||||
SDKROOT[arch=ppc] = macosx10.4
|
||||
|
||||
GCC_VERSION = 4.2
|
||||
GCC_VERSION[sdk=macosx10.4][arch=*] = 4.0
|
||||
|
||||
GCC_C_LANGUAGE_STANDARD = c99
|
||||
|
||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
|
||||
// TODO(nealsid): Get the code so we can turn on the 64_TO_32 warning.
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES
|
||||
GCC_WARN_MISSING_PARENTHESES = YES
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES
|
||||
GCC_WARN_SIGN_COMPARE = YES
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES
|
||||
GCC_WARN_UNUSED_VARIABLE = YES
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES
|
||||
|
||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
32
src/common/mac/BreakpadDebug.xcconfig
Normal file
32
src/common/mac/BreakpadDebug.xcconfig
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) 2010, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "Breakpad.xcconfig"
|
||||
|
||||
GCC_OPTIMIZATION_LEVEL = 0
|
||||
33
src/common/mac/BreakpadRelease.xcconfig
Normal file
33
src/common/mac/BreakpadRelease.xcconfig
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) 2010, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "Breakpad.xcconfig"
|
||||
|
||||
GCC_OPTIMIZATION_LEVEL = s
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#import "HTTPMultipartUpload.h"
|
||||
#import "GTMDefines.h"
|
||||
|
||||
@interface HTTPMultipartUpload(PrivateMethods)
|
||||
- (NSString *)multipartBoundary;
|
||||
|
|
@ -148,7 +149,6 @@
|
|||
timeoutInterval:10.0 ];
|
||||
|
||||
NSMutableData *postBody = [NSMutableData data];
|
||||
int i, count;
|
||||
|
||||
[req setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@",
|
||||
boundary_] forHTTPHeaderField:@"Content-type"];
|
||||
|
|
@ -157,8 +157,8 @@
|
|||
NSArray *parameterKeys = [parameters_ allKeys];
|
||||
NSString *key;
|
||||
|
||||
count = [parameterKeys count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
NSInteger count = [parameterKeys count];
|
||||
for (NSInteger i = 0; i < count; ++i) {
|
||||
key = [parameterKeys objectAtIndex:i];
|
||||
[postBody appendData:[self formDataForKey:key
|
||||
value:[parameters_ objectForKey:key]]];
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
// Add any files to the message
|
||||
NSArray *fileNames = [files_ allKeys];
|
||||
count = [fileNames count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
for (NSInteger i = 0; i < count; ++i) {
|
||||
NSString *name = [fileNames objectAtIndex:i];
|
||||
id fileOrData = [files_ objectForKey:name];
|
||||
NSData *fileData;
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ class MachMessage {
|
|||
void SetDescriptor(int n, const MachMsgPortDescriptor &desc);
|
||||
|
||||
// Returns total message size setting msgh_size in the header to this value
|
||||
int CalculateSize();
|
||||
mach_msg_size_t CalculateSize();
|
||||
|
||||
mach_msg_header_t head;
|
||||
mach_msg_body_t body;
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ MachSendMessage::MachSendMessage(int32_t message_id) : MachMessage() {
|
|||
bool MachMessage::SetData(void *data,
|
||||
int32_t data_length) {
|
||||
// first check to make sure we have enough space
|
||||
int size = CalculateSize();
|
||||
int new_size = size + data_length;
|
||||
size_t size = CalculateSize();
|
||||
size_t new_size = size + data_length;
|
||||
|
||||
if ((unsigned)new_size > sizeof(MachMessage)) {
|
||||
if (new_size > sizeof(MachMessage)) {
|
||||
return false; // not enough space
|
||||
}
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ bool MachMessage::SetData(void *data,
|
|||
// calculates and returns the total size of the message
|
||||
// Currently, the entire message MUST fit inside of the MachMessage
|
||||
// messsage size <= sizeof(MachMessage)
|
||||
int MachMessage::CalculateSize() {
|
||||
int size = sizeof(mach_msg_header_t) + sizeof(mach_msg_body_t);
|
||||
mach_msg_size_t MachMessage::CalculateSize() {
|
||||
size_t size = sizeof(mach_msg_header_t) + sizeof(mach_msg_body_t);
|
||||
|
||||
// add space for MessageDataPacket
|
||||
int32_t alignedDataLength = (GetDataLength() + 3) & ~0x3;
|
||||
|
|
@ -82,14 +82,14 @@ int MachMessage::CalculateSize() {
|
|||
// add space for descriptors
|
||||
size += GetDescriptorCount() * sizeof(MachMsgPortDescriptor);
|
||||
|
||||
head.msgh_size = size;
|
||||
head.msgh_size = static_cast<mach_msg_size_t>(size);
|
||||
|
||||
return size;
|
||||
return head.msgh_size;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
MachMessage::MessageDataPacket *MachMessage::GetDataPacket() {
|
||||
int desc_size = sizeof(MachMsgPortDescriptor)*GetDescriptorCount();
|
||||
size_t desc_size = sizeof(MachMsgPortDescriptor)*GetDescriptorCount();
|
||||
MessageDataPacket *packet =
|
||||
reinterpret_cast<MessageDataPacket*>(padding + desc_size);
|
||||
|
||||
|
|
@ -109,9 +109,9 @@ void MachMessage::SetDescriptor(int n,
|
|||
bool MachMessage::AddDescriptor(const MachMsgPortDescriptor &desc) {
|
||||
// first check to make sure we have enough space
|
||||
int size = CalculateSize();
|
||||
int new_size = size + sizeof(MachMsgPortDescriptor);
|
||||
size_t new_size = size + sizeof(MachMsgPortDescriptor);
|
||||
|
||||
if ((unsigned)new_size > sizeof(MachMessage)) {
|
||||
if (new_size > sizeof(MachMessage)) {
|
||||
return false; // not enough space
|
||||
}
|
||||
|
||||
|
|
@ -180,8 +180,8 @@ ReceivePort::ReceivePort(const char *receive_port_name) {
|
|||
if (init_result_ != KERN_SUCCESS)
|
||||
return;
|
||||
|
||||
mach_port_t bootstrap_port = 0;
|
||||
init_result_ = task_get_bootstrap_port(current_task, &bootstrap_port);
|
||||
mach_port_t task_bootstrap_port = 0;
|
||||
init_result_ = task_get_bootstrap_port(current_task, &task_bootstrap_port);
|
||||
|
||||
if (init_result_ != KERN_SUCCESS)
|
||||
return;
|
||||
|
|
@ -256,13 +256,14 @@ kern_return_t ReceivePort::WaitForMessage(MachReceiveMessage *out_message,
|
|||
//==============================================================================
|
||||
// get a port with send rights corresponding to a named registered service
|
||||
MachPortSender::MachPortSender(const char *receive_port_name) {
|
||||
mach_port_t bootstrap_port = 0;
|
||||
init_result_ = task_get_bootstrap_port(mach_task_self(), &bootstrap_port);
|
||||
mach_port_t task_bootstrap_port = 0;
|
||||
init_result_ = task_get_bootstrap_port(mach_task_self(),
|
||||
&task_bootstrap_port);
|
||||
|
||||
if (init_result_ != KERN_SUCCESS)
|
||||
return;
|
||||
|
||||
init_result_ = bootstrap_look_up(bootstrap_port,
|
||||
init_result_ = bootstrap_look_up(task_bootstrap_port,
|
||||
const_cast<char*>(receive_port_name),
|
||||
&send_port_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,17 @@ 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,
|
||||
// and leave this dumper's selected architecture unchanged.
|
||||
//
|
||||
// By default, if this dumper's file contains only one object file, then
|
||||
// the dumper will dump those symbols; and if it contains more than one
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@
|
|||
#include "common/stabs_reader.h"
|
||||
#include "common/stabs_to_module.h"
|
||||
|
||||
#ifndef CPU_TYPE_ARM
|
||||
#define CPU_TYPE_ARM (static_cast<cpu_type_t>(12))
|
||||
#endif // CPU_TYPE_ARM
|
||||
|
||||
using dwarf2reader::ByteReader;
|
||||
using google_breakpad::DwarfCUToModule;
|
||||
using google_breakpad::DwarfLineToModule;
|
||||
|
|
@ -176,7 +180,7 @@ bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type,
|
|||
// Find the best match for the architecture the user requested.
|
||||
const struct fat_arch *best_match
|
||||
= NXFindBestFatArch(cpu_type, cpu_subtype, &object_files_[0],
|
||||
object_files_.size());
|
||||
static_cast<uint32_t>(object_files_.size()));
|
||||
if (!best_match) return false;
|
||||
|
||||
// Record the selected object file.
|
||||
|
|
@ -184,6 +188,15 @@ bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DumpSymbols::SetArchitecture(const std::string &arch_name) {
|
||||
bool arch_set = false;
|
||||
const NXArchInfo *arch_info = NXGetArchInfoFromName(arch_name.c_str());
|
||||
if (arch_info) {
|
||||
arch_set = SetArchitecture(arch_info->cputype, arch_info->cpusubtype);
|
||||
}
|
||||
return arch_set;
|
||||
}
|
||||
|
||||
string DumpSymbols::Identifier() {
|
||||
FileID file_id([object_filename_ fileSystemRepresentation]);
|
||||
unsigned char identifier_bytes[16];
|
||||
|
|
|
|||
|
|
@ -53,7 +53,12 @@ extern "C" { // necessary for Leopard
|
|||
|
||||
namespace MacFileUtilities {
|
||||
|
||||
MachoID::MachoID(const char *path) {
|
||||
MachoID::MachoID(const char *path)
|
||||
: file_(0),
|
||||
crc_(0),
|
||||
md5_context_(),
|
||||
sha1_context_(),
|
||||
update_function_(NULL) {
|
||||
strlcpy(path_, path, sizeof(path_));
|
||||
file_ = open(path, O_RDONLY);
|
||||
}
|
||||
|
|
@ -119,7 +124,7 @@ void MachoID::UpdateSHA1(unsigned char *bytes, size_t size) {
|
|||
SHA_Update(&sha1_context_, bytes, size);
|
||||
}
|
||||
|
||||
void MachoID::Update(MachoWalker *walker, unsigned long offset, size_t size) {
|
||||
void MachoID::Update(MachoWalker *walker, off_t offset, size_t size) {
|
||||
if (!update_function_ || !size)
|
||||
return;
|
||||
|
||||
|
|
@ -182,7 +187,7 @@ bool MachoID::IDCommand(int cpu_type, unsigned char identifier[16]) {
|
|||
identifier[2] = 0;
|
||||
identifier[3] = 0;
|
||||
|
||||
for (int j = 0, i = strlen(path_)-1; i >= 0 && path_[i]!='/'; ++j, --i) {
|
||||
for (int j = 0, i = (int)strlen(path_)-1; i>=0 && path_[i]!='/'; ++j, --i) {
|
||||
identifier[j%4] += path_[i];
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +318,9 @@ bool MachoID::WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
|
|||
// sections of type S_ZEROFILL are "virtual" and contain no data
|
||||
// in the file itself
|
||||
if ((sec64.flags & SECTION_TYPE) != S_ZEROFILL && sec64.offset != 0)
|
||||
macho_id->Update(walker, header_offset + sec64.offset, sec64.size);
|
||||
macho_id->Update(walker,
|
||||
header_offset + sec64.offset,
|
||||
(size_t)sec64.size);
|
||||
|
||||
offset += sizeof(struct section_64);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class MachoID {
|
|||
void UpdateSHA1(unsigned char *bytes, size_t size);
|
||||
|
||||
// Bottleneck for update routines
|
||||
void Update(MachoWalker *walker, unsigned long offset, size_t size);
|
||||
void Update(MachoWalker *walker, off_t offset, size_t size);
|
||||
|
||||
// The callback from the MachoWalker for CRC, MD5, and SHA1
|
||||
static bool WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ bool FatReader::Read(const uint8_t *buffer, size_t size) {
|
|||
}
|
||||
|
||||
object_files_[0].offset = 0;
|
||||
object_files_[0].size = buffer_.Size();
|
||||
object_files_[0].size = static_cast<uint32_t>(buffer_.Size());
|
||||
// This alignment is correct for 32 and 64-bit x86 and ppc.
|
||||
// See get_align in the lipo source for other architectures:
|
||||
// http://www.opensource.apple.com/source/cctools/cctools-773/misc/lipo.c
|
||||
|
|
|
|||
|
|
@ -992,7 +992,7 @@ TEST_F(LoadCommand, None) {
|
|||
EXPECT_FALSE(reader.big_endian());
|
||||
EXPECT_EQ(CPU_TYPE_X86, reader.cpu_type());
|
||||
EXPECT_EQ(CPU_SUBTYPE_I386_ALL, reader.cpu_subtype());
|
||||
EXPECT_EQ(MH_EXECUTE, reader.file_type());
|
||||
EXPECT_EQ(static_cast<uint32_t>(MH_EXECUTE), reader.file_type());
|
||||
EXPECT_EQ(FileFlags(MH_TWOLEVEL |
|
||||
MH_DYLDLINK |
|
||||
MH_NOUNDEFS),
|
||||
|
|
@ -1018,7 +1018,7 @@ TEST_F(LoadCommand, Unknown) {
|
|||
EXPECT_TRUE(reader.big_endian());
|
||||
EXPECT_EQ(CPU_TYPE_X86, reader.cpu_type());
|
||||
EXPECT_EQ(CPU_SUBTYPE_I386_ALL, reader.cpu_subtype());
|
||||
EXPECT_EQ(MH_EXECUTE, reader.file_type());
|
||||
EXPECT_EQ(static_cast<uint32_t>(MH_EXECUTE), reader.file_type());
|
||||
EXPECT_EQ(FileFlags(MH_TWOLEVEL |
|
||||
MH_DYLDLINK |
|
||||
MH_NOUNDEFS),
|
||||
|
|
|
|||
|
|
@ -52,7 +52,11 @@ namespace MacFileUtilities {
|
|||
MachoWalker::MachoWalker(const char *path, LoadCommandCallback callback,
|
||||
void *context)
|
||||
: callback_(callback),
|
||||
callback_context_(context) {
|
||||
callback_context_(context),
|
||||
file_(0),
|
||||
current_header_(NULL),
|
||||
current_header_size_(0),
|
||||
current_header_offset_(0) {
|
||||
file_ = open(path, O_RDONLY);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@ class MachoWalker {
|
|||
struct mach_header_64 *current_header_;
|
||||
unsigned long current_header_size_;
|
||||
off_t current_header_offset_;
|
||||
|
||||
private:
|
||||
MachoWalker(const MachoWalker &);
|
||||
MachoWalker &operator=(const MachoWalker &);
|
||||
};
|
||||
|
||||
} // namespace MacFileUtilities
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ unsigned int IntegerValueAtIndex(string &str, unsigned int idx) {
|
|||
size_t start = 0;
|
||||
size_t end;
|
||||
size_t found = 0;
|
||||
size_t result = 0;
|
||||
unsigned int result = 0;
|
||||
|
||||
for (; found <= idx; ++found) {
|
||||
end = str.find_first_not_of(digits, start);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ Module::Module(const string &name, const string &os,
|
|||
Module::~Module() {
|
||||
for (FileByNameMap::iterator it = files_.begin(); it != files_.end(); it++)
|
||||
delete it->second;
|
||||
for (set<Function *>::iterator it = functions_.begin();
|
||||
for (FunctionSet::iterator it = functions_.begin();
|
||||
it != functions_.end(); it++)
|
||||
delete *it;
|
||||
for (vector<StackFrameEntry *>::iterator it = stack_frame_entries_.begin();
|
||||
|
|
@ -62,7 +62,7 @@ void Module::SetLoadAddress(Address address) {
|
|||
}
|
||||
|
||||
void Module::AddFunction(Function *function) {
|
||||
std::pair<set<Function *>::iterator,bool> ret = functions_.insert(function);
|
||||
std::pair<FunctionSet::iterator,bool> ret = functions_.insert(function);
|
||||
if (!ret.second) {
|
||||
// Free the duplicate we failed to insert because we own it.
|
||||
delete function;
|
||||
|
|
@ -135,7 +135,7 @@ void Module::AssignSourceIds() {
|
|||
|
||||
// Next, mark all files actually cited by our functions' line number
|
||||
// info, by setting each one's source id to zero.
|
||||
for (set<Function *>::const_iterator func_it = functions_.begin();
|
||||
for (FunctionSet::const_iterator func_it = functions_.begin();
|
||||
func_it != functions_.end(); func_it++) {
|
||||
Function *func = *func_it;
|
||||
for (vector<Line>::iterator line_it = func->lines.begin();
|
||||
|
|
@ -192,7 +192,7 @@ bool Module::Write(FILE *stream) {
|
|||
}
|
||||
|
||||
// Write out functions and their lines.
|
||||
for (set<Function *>::const_iterator func_it = functions_.begin();
|
||||
for (FunctionSet::const_iterator func_it = functions_.begin();
|
||||
func_it != functions_.end(); func_it++) {
|
||||
Function *func = *func_it;
|
||||
if (0 > fprintf(stream, "FUNC %llx %llx %llx %s\n",
|
||||
|
|
|
|||
|
|
@ -274,7 +274,8 @@ class Module {
|
|||
// to it; destroying the module frees the Files and Functions these
|
||||
// point to.
|
||||
FileByNameMap files_; // This module's source files.
|
||||
set<Function *, FunctionCompare> functions_; // This module's functions.
|
||||
typedef set<Function *, FunctionCompare> FunctionSet;
|
||||
FunctionSet functions_; // This module's functions.
|
||||
|
||||
// The module owns all the call frame info entries that have been
|
||||
// added to it.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ using testing::ContainerEq;
|
|||
|
||||
// Return a FILE * referring to a temporary file that will be deleted
|
||||
// automatically when the stream is closed or the program exits.
|
||||
FILE *checked_tmpfile() {
|
||||
static FILE *checked_tmpfile() {
|
||||
FILE *f = tmpfile();
|
||||
if (!f) {
|
||||
fprintf(stderr, "error creating temporary file: %s\n", strerror(errno));
|
||||
|
|
@ -60,7 +60,7 @@ FILE *checked_tmpfile() {
|
|||
|
||||
// Read from STREAM until end of file, and return the contents as a
|
||||
// string.
|
||||
string checked_read(FILE *stream) {
|
||||
static string checked_read(FILE *stream) {
|
||||
string contents;
|
||||
int c;
|
||||
while ((c = getc(stream)) != EOF)
|
||||
|
|
@ -74,7 +74,7 @@ string checked_read(FILE *stream) {
|
|||
}
|
||||
|
||||
// Apply 'fflush' to STREAM, and check for errors.
|
||||
void checked_fflush(FILE *stream) {
|
||||
static void checked_fflush(FILE *stream) {
|
||||
if (fflush(stream) == EOF) {
|
||||
fprintf(stderr, "error flushing temporary file stream: %s\n",
|
||||
strerror(errno));
|
||||
|
|
@ -83,7 +83,7 @@ void checked_fflush(FILE *stream) {
|
|||
}
|
||||
|
||||
// Apply 'fclose' to STREAM, and check for errors.
|
||||
void checked_fclose(FILE *stream) {
|
||||
static void checked_fclose(FILE *stream) {
|
||||
if (fclose(stream) == EOF) {
|
||||
fprintf(stderr, "error closing temporary file stream: %s\n",
|
||||
strerror(errno));
|
||||
|
|
@ -91,7 +91,7 @@ void checked_fclose(FILE *stream) {
|
|||
}
|
||||
}
|
||||
|
||||
Module::Function *generate_duplicate_function(const string &name) {
|
||||
static Module::Function *generate_duplicate_function(const string &name) {
|
||||
const Module::Address DUP_ADDRESS = 0xd35402aac7a7ad5cLL;
|
||||
const Module::Address DUP_SIZE = 0x200b26e605f99071LL;
|
||||
const Module::Address DUP_PARAMETER_SIZE = 0xf14ac4fed48c4a99LL;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ int UTF8ToUTF16Char(const char *in, int in_length, u_int16_t out[2]) {
|
|||
strictConversion);
|
||||
|
||||
if (result == conversionOK)
|
||||
return source_ptr - reinterpret_cast<const UTF8 *>(in);
|
||||
return static_cast<int>(source_ptr - reinterpret_cast<const UTF8 *>(in));
|
||||
|
||||
// Add another character to the input stream and try again
|
||||
source_ptr = reinterpret_cast<const UTF8 *>(in);
|
||||
|
|
@ -135,7 +135,7 @@ string UTF16ToUTF8(const vector<u_int16_t> &in, bool swap) {
|
|||
|
||||
// The maximum expansion would be 4x the size of the input string.
|
||||
const UTF16 *source_end_ptr = source_ptr + in.size();
|
||||
int target_capacity = in.size() * 4;
|
||||
size_t target_capacity = in.size() * 4;
|
||||
scoped_array<UTF8> target_buffer(new UTF8[target_capacity]);
|
||||
UTF8 *target_ptr = target_buffer.get();
|
||||
UTF8 *target_end_ptr = target_ptr + target_capacity;
|
||||
|
|
@ -145,8 +145,7 @@ string UTF16ToUTF8(const vector<u_int16_t> &in, bool swap) {
|
|||
|
||||
if (result == conversionOK) {
|
||||
const char *targetPtr = reinterpret_cast<const char *>(target_buffer.get());
|
||||
string result(targetPtr);
|
||||
return result;
|
||||
return targetPtr;
|
||||
}
|
||||
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@
|
|||
#include "breakpad_googletest_includes.h"
|
||||
#include "common/test_assembler.h"
|
||||
|
||||
using google_breakpad::TestAssembler::Label;
|
||||
using google_breakpad::TestAssembler::Section;
|
||||
using google_breakpad::TestAssembler::kBigEndian;
|
||||
using google_breakpad::TestAssembler::kLittleEndian;
|
||||
using google_breakpad::test_assembler::Label;
|
||||
using google_breakpad::test_assembler::Section;
|
||||
using google_breakpad::test_assembler::kBigEndian;
|
||||
using google_breakpad::test_assembler::kLittleEndian;
|
||||
using std::string;
|
||||
using testing::Test;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue