diff options
Diffstat (limited to '3rdParty/Breakpad/src/common/mac/macho_reader.cc')
-rw-r--r-- | 3rdParty/Breakpad/src/common/mac/macho_reader.cc | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/3rdParty/Breakpad/src/common/mac/macho_reader.cc b/3rdParty/Breakpad/src/common/mac/macho_reader.cc index f1f0a17..52f3c41 100644 --- a/3rdParty/Breakpad/src/common/mac/macho_reader.cc +++ b/3rdParty/Breakpad/src/common/mac/macho_reader.cc @@ -45,2 +45,6 @@ +#if !defined(CPU_TYPE_ARM_64) +#define CPU_TYPE_ARM_64 16777228 +#endif + namespace google_breakpad { @@ -99,10 +103,14 @@ bool FatReader::Read(const uint8_t *buffer, size_t size) { for (size_t i = 0; i < object_files_count; i++) { - struct fat_arch *objfile = &object_files_[i]; + struct fat_arch objfile; // Read this object file entry, byte-swapping as appropriate. - cursor >> objfile->cputype - >> objfile->cpusubtype - >> objfile->offset - >> objfile->size - >> objfile->align; + cursor >> objfile.cputype + >> objfile.cpusubtype + >> objfile.offset + >> objfile.size + >> objfile.align; + + SuperFatArch super_fat_arch(objfile); + object_files_[i] = super_fat_arch; + if (!cursor) { @@ -113,4 +121,4 @@ bool FatReader::Read(const uint8_t *buffer, size_t size) { size_t fat_size = buffer_.Size(); - if (objfile->offset > fat_size || - objfile->size > fat_size - objfile->offset) { + if (objfile.offset > fat_size || + objfile.size > fat_size - objfile.offset) { reporter_->MisplacedObjectFile(); @@ -137,3 +145,3 @@ bool FatReader::Read(const uint8_t *buffer, size_t size) { object_files_[0].offset = 0; - object_files_[0].size = static_cast<uint32_t>(buffer_.Size()); + object_files_[0].size = static_cast<uint64_t>(buffer_.Size()); // This alignment is correct for 32 and 64-bit x86 and ppc. @@ -142,3 +150,2 @@ bool FatReader::Read(const uint8_t *buffer, size_t size) { object_files_[0].align = 12; // 2^12 == 4096 - return true; @@ -146,3 +153,2 @@ bool FatReader::Read(const uint8_t *buffer, size_t size) { } - reporter_->BadHeader(); @@ -177,4 +183,4 @@ void Reader::Reporter::LoadCommandsOverrun(size_t claimed, size_t i, LoadCommandType type) { - fprintf(stderr, "%s: file's header claims there are %ld" - " load commands, but load command #%ld", + fprintf(stderr, "%s: file's header claims there are %zu" + " load commands, but load command #%zu", filename_.c_str(), claimed, i); @@ -185,3 +191,3 @@ void Reader::Reporter::LoadCommandsOverrun(size_t claimed, size_t i, void Reader::Reporter::LoadCommandTooShort(size_t i, LoadCommandType type) { - fprintf(stderr, "%s: the contents of load command #%ld, of type %d," + fprintf(stderr, "%s: the contents of load command #%zu, of type %d," " extend beyond the size given in the load command's header\n", @@ -244,2 +250,3 @@ bool Reader::Read(const uint8_t *buffer, break; + case CPU_TYPE_ARM_64: case CPU_TYPE_X86_64: @@ -312,3 +319,3 @@ bool Reader::WalkLoadCommands(Reader::LoadCommandHandler *handler) const { ByteCursor cursor(&command, big_endian_); - + // Read the command type and size --- fields common to all commands. @@ -397,3 +404,3 @@ bool Reader::WalkLoadCommands(Reader::LoadCommandHandler *handler) const { } - + default: { @@ -416,3 +423,3 @@ class Reader::SegmentFinder : public LoadCommandHandler { // and sets SEGMENT to describe it if found. - SegmentFinder(const string &name, Segment *segment) + SegmentFinder(const string &name, Segment *segment) : name_(name), segment_(segment), found_() { } @@ -476,6 +483,8 @@ bool Reader::WalkSegmentSections(const Segment &segment, } - if ((section.flags & SECTION_TYPE) == S_ZEROFILL) { + const uint32_t section_type = section.flags & SECTION_TYPE; + if (section_type == S_ZEROFILL || section_type == S_THREAD_LOCAL_ZEROFILL || + section_type == S_GB_ZEROFILL) { // Zero-fill sections have a size, but no contents. section.contents.start = section.contents.end = NULL; - } else if (segment.contents.start == NULL && + } else if (segment.contents.start == NULL && segment.contents.end == NULL) { |