summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Doukoudakis <thanos.doukoudakis@isode.com>2017-10-16 11:53:42 (GMT)
committerKevin Smith <kevin.smith@isode.com>2017-10-19 09:22:57 (GMT)
commiteb07238e9c1a09a640dae06e8a433d7dba77f490 (patch)
tree51b618bbdf933bcca2b8deb915e131c48d80d5f7 /3rdParty/Breakpad/src/common/mac/macho_id.cc
parent80ef26c165a08d5251d7ee56e0bd07b86fc82f55 (diff)
downloadswift-eb07238e9c1a09a640dae06e8a433d7dba77f490.zip
swift-eb07238e9c1a09a640dae06e8a433d7dba77f490.tar.bz2
Upgrade Breakpad to latest
This commit will upgrade breakpad to version 1.0.86 (I9957f27cd134f862b9831e4b1d90f8a014eb37b6) from https://chromium.googlesource.com/breakpad/breakpad Added a script(BreakpadSwiftCleanup.sh) that remove files from Breakpad's repository that are not used by Swift. This commit also re-applies the changes that were introduced in commit 7f0fe603be200c09c74cf9cc295a972f3c3dbdfd, that change the minidump filename format to include version and date Test-Information: https://travis-ci.org/google/breakpad/builds/283789304 https://ci.appveyor.com/project/vapier/breakpad/build/job/1bu73ysmcfpwg9e4 Tested by adding some code that forces a crash to the client on Windows 10 with VS2015. Verified the name and contents of the generated crash dump. Change-Id: Ied9e74088e43137845edc09d070c2c27494aeade
Diffstat (limited to '3rdParty/Breakpad/src/common/mac/macho_id.cc')
-rw-r--r--3rdParty/Breakpad/src/common/mac/macho_id.cc65
1 files changed, 34 insertions, 31 deletions
diff --git a/3rdParty/Breakpad/src/common/mac/macho_id.cc b/3rdParty/Breakpad/src/common/mac/macho_id.cc
index abe1fab..c396ad8 100644
--- a/3rdParty/Breakpad/src/common/mac/macho_id.cc
+++ b/3rdParty/Breakpad/src/common/mac/macho_id.cc
@@ -33,17 +33,15 @@
//
// Author: Dan Waylonis
-extern "C" { // necessary for Leopard
- #include <fcntl.h>
- #include <mach-o/loader.h>
- #include <mach-o/swap.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/time.h>
- #include <sys/types.h>
- #include <unistd.h>
-}
+
+#include <fcntl.h>
+#include <mach-o/loader.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
#include "common/mac/macho_id.h"
#include "common/mac/macho_walker.h"
@@ -61,7 +59,7 @@ MachoID::MachoID(const char *path)
crc_(0),
md5_context_(),
update_function_(NULL) {
- strlcpy(path_, path, sizeof(path_));
+ snprintf(path_, sizeof(path_), "%s", path);
}
MachoID::MachoID(const char *path, void *memory, size_t size)
@@ -70,7 +68,7 @@ MachoID::MachoID(const char *path, void *memory, size_t size)
crc_(0),
md5_context_(),
update_function_(NULL) {
- strlcpy(path_, path, sizeof(path_));
+ snprintf(path_, sizeof(path_), "%s", path);
}
MachoID::~MachoID() {
@@ -125,7 +123,7 @@ void MachoID::UpdateCRC(unsigned char *bytes, size_t size) {
}
void MachoID::UpdateMD5(unsigned char *bytes, size_t size) {
- MD5Update(&md5_context_, bytes, size);
+ MD5Update(&md5_context_, bytes, static_cast<unsigned>(size));
}
void MachoID::Update(MachoWalker *walker, off_t offset, size_t size) {
@@ -153,10 +151,12 @@ void MachoID::Update(MachoWalker *walker, off_t offset, size_t size) {
}
}
-bool MachoID::UUIDCommand(int cpu_type, unsigned char bytes[16]) {
+bool MachoID::UUIDCommand(cpu_type_t cpu_type,
+ cpu_subtype_t cpu_subtype,
+ unsigned char bytes[16]) {
struct breakpad_uuid_command uuid_cmd;
uuid_cmd.cmd = 0;
- if (!WalkHeader(cpu_type, UUIDWalkerCB, &uuid_cmd))
+ if (!WalkHeader(cpu_type, cpu_subtype, UUIDWalkerCB, &uuid_cmd))
return false;
// If we found the command, we'll have initialized the uuid_command
@@ -169,10 +169,12 @@ bool MachoID::UUIDCommand(int cpu_type, unsigned char bytes[16]) {
return false;
}
-bool MachoID::IDCommand(int cpu_type, unsigned char identifier[16]) {
+bool MachoID::IDCommand(cpu_type_t cpu_type,
+ cpu_subtype_t cpu_subtype,
+ unsigned char identifier[16]) {
struct dylib_command dylib_cmd;
dylib_cmd.cmd = 0;
- if (!WalkHeader(cpu_type, IDWalkerCB, &dylib_cmd))
+ if (!WalkHeader(cpu_type, cpu_subtype, IDWalkerCB, &dylib_cmd))
return false;
// If we found the command, we'll have initialized the dylib_command
@@ -210,37 +212,38 @@ bool MachoID::IDCommand(int cpu_type, unsigned char identifier[16]) {
return false;
}
-uint32_t MachoID::Adler32(int cpu_type) {
+uint32_t MachoID::Adler32(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) {
update_function_ = &MachoID::UpdateCRC;
crc_ = 0;
- if (!WalkHeader(cpu_type, WalkerCB, this))
+ if (!WalkHeader(cpu_type, cpu_subtype, WalkerCB, this))
return 0;
return crc_;
}
-bool MachoID::MD5(int cpu_type, unsigned char identifier[16]) {
+bool MachoID::MD5(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype, unsigned char identifier[16]) {
update_function_ = &MachoID::UpdateMD5;
MD5Init(&md5_context_);
- if (!WalkHeader(cpu_type, WalkerCB, this))
+ if (!WalkHeader(cpu_type, cpu_subtype, WalkerCB, this))
return false;
MD5Final(identifier, &md5_context_);
return true;
}
-bool MachoID::WalkHeader(int cpu_type,
+bool MachoID::WalkHeader(cpu_type_t cpu_type,
+ cpu_subtype_t cpu_subtype,
MachoWalker::LoadCommandCallback callback,
void *context) {
if (memory_) {
MachoWalker walker(memory_, memory_size_, callback, context);
- return walker.WalkHeader(cpu_type);
+ return walker.WalkHeader(cpu_type, cpu_subtype);
} else {
MachoWalker walker(path_, callback, context);
- return walker.WalkHeader(cpu_type);
+ return walker.WalkHeader(cpu_type, cpu_subtype);
}
}
@@ -256,7 +259,7 @@ bool MachoID::WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
return false;
if (swap)
- swap_segment_command(&seg, NXHostByteOrder());
+ breakpad_swap_segment_command(&seg);
struct mach_header_64 header;
off_t header_offset;
@@ -273,7 +276,7 @@ bool MachoID::WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
return false;
if (swap)
- swap_section(&sec, 1, NXHostByteOrder());
+ breakpad_swap_section(&sec, 1);
// sections of type S_ZEROFILL are "virtual" and contain no data
// in the file itself
@@ -289,7 +292,7 @@ bool MachoID::WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
return false;
if (swap)
- breakpad_swap_segment_command_64(&seg64, NXHostByteOrder());
+ breakpad_swap_segment_command_64(&seg64);
struct mach_header_64 header;
off_t header_offset;
@@ -306,7 +309,7 @@ bool MachoID::WalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
return false;
if (swap)
- breakpad_swap_section_64(&sec64, 1, NXHostByteOrder());
+ breakpad_swap_section_64(&sec64, 1);
// sections of type S_ZEROFILL are "virtual" and contain no data
// in the file itself
@@ -335,7 +338,7 @@ bool MachoID::UUIDWalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
return false;
if (swap)
- breakpad_swap_uuid_command(uuid_cmd, NXHostByteOrder());
+ breakpad_swap_uuid_command(uuid_cmd);
return false;
}
@@ -354,7 +357,7 @@ bool MachoID::IDWalkerCB(MachoWalker *walker, load_command *cmd, off_t offset,
return false;
if (swap)
- swap_dylib_command(dylib_cmd, NXHostByteOrder());
+ breakpad_swap_dylib_command(dylib_cmd);
return false;
}