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:
dmaclach 2010-07-19 20:43:49 +00:00
parent 786275e719
commit 4ac61acb3a
53 changed files with 1791 additions and 1084 deletions

View 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

View 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

View 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

View file

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

View file

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

View file

@ -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_);
}

View file

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

View file

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

View file

@ -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);
}

View file

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

View file

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

View file

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

View file

@ -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);
}

View file

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

View file

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