bug 543111 - Fix Mac Breakpad host tools to build in Linux cross-compile. r=mento,glandium
authorTed Mielczarek <ted@mielczarek.org>
Thu, 01 Oct 2015 15:04:27 -0400
changeset 265634 8de36593cd3b0ecd534efba8e36d73ee4a7692d8
parent 265633 e5776222e1f15764a328d1d0a07ee16c7b662988
child 265635 005520a2b6d78064e4e57b63a5b4b6a1854a30fd
push id15472
push usercbook@mozilla.com
push dateFri, 02 Oct 2015 11:51:34 +0000
treeherderfx-team@2c33ef6b27e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmento, glandium
bugs543111
milestone44.0a1
bug 543111 - Fix Mac Breakpad host tools to build in Linux cross-compile. r=mento,glandium
toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in
toolkit/crashreporter/google-breakpad/src/common/mac/arch_utilities.cc
toolkit/crashreporter/google-breakpad/src/common/mac/byteswap.h
toolkit/crashreporter/google-breakpad/src/common/mac/dump_syms.cc
toolkit/crashreporter/google-breakpad/src/common/mac/dump_syms.h
toolkit/crashreporter/google-breakpad/src/common/mac/dump_syms.mm
toolkit/crashreporter/google-breakpad/src/common/mac/file_id.cc
toolkit/crashreporter/google-breakpad/src/common/mac/macho_id.cc
toolkit/crashreporter/google-breakpad/src/common/mac/macho_utilities.cc
toolkit/crashreporter/google-breakpad/src/common/mac/macho_utilities.h
toolkit/crashreporter/google-breakpad/src/common/mac/macho_walker.cc
toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
toolkit/crashreporter/google-breakpad/src/common/moz.build
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/README
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/architecture/byte_order.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/i386/_types.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach-o/arch.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach-o/fat.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach-o/loader.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach-o/nlist.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/boolean.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/i386/boolean.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/i386/vm_param.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/i386/vm_types.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine/boolean.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine/thread_state.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine/thread_status.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine/vm_types.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/thread_status.h
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/vm_prot.h
toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/Makefile.in
toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/dump_syms_tool.cc
toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/dump_syms_tool.mm
toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
tools/profiler/core/shim_mac_dump_syms.mm
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/Makefile.in
@@ -0,0 +1,1 @@
+%/dump_syms.mm: ;
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/arch_utilities.cc
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/arch_utilities.cc
@@ -25,31 +25,32 @@
 // 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 "common/mac/arch_utilities.h"
 
 #include <mach-o/arch.h>
+#include <mach-o/fat.h>
 #include <stdio.h>
 #include <string.h>
 
-#ifndef CPU_TYPE_ARM
-#define CPU_TYPE_ARM (static_cast<cpu_type_t>(12))
-#endif  // CPU_TYPE_ARM
-
-#ifndef CPU_SUBTYPE_ARM_V7
-#define CPU_SUBTYPE_ARM_V7 (static_cast<cpu_subtype_t>(9))
-#endif  // CPU_SUBTYPE_ARM_V7
-
 #ifndef CPU_SUBTYPE_ARM_V7S
 #define CPU_SUBTYPE_ARM_V7S (static_cast<cpu_subtype_t>(11))
 #endif  // CPU_SUBTYPE_ARM_V7S
 
+#ifndef CPU_TYPE_ARM64
+#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
+#endif  // CPU_TYPE_ARM64
+
+#ifndef CPU_SUBTYPE_ARM64_ALL
+#define CPU_SUBTYPE_ARM64_ALL (static_cast<cpu_subtype_t>(0))
+#endif  // CPU_SUBTYPE_ARM64_ALL
+
 namespace {
 
 const NXArchInfo* ArchInfo_armv7s() {
   NXArchInfo* armv7s = new NXArchInfo;
   *armv7s = *NXGetArchInfoFromCpuType(CPU_TYPE_ARM,
                                       CPU_SUBTYPE_ARM_V7);
   armv7s->name = "armv7s";
   armv7s->cpusubtype = CPU_SUBTYPE_ARM_V7S;
@@ -74,8 +75,113 @@ const NXArchInfo* BreakpadGetArchInfoFro
   if (cpu_type == CPU_TYPE_ARM && cpu_subtype == CPU_SUBTYPE_ARM_V7S) {
     static const NXArchInfo* armv7s = ArchInfo_armv7s();
     return armv7s;
   }
   return NXGetArchInfoFromCpuType(cpu_type, cpu_subtype);
 }
 
 }  // namespace google_breakpad
+
+#ifndef __APPLE__
+namespace {
+
+enum Architecture {
+  kArch_i386 = 0,
+  kArch_x86_64,
+  kArch_arm,
+  kArch_arm64,
+  kArch_ppc,
+  // This must be last.
+  kNumArchitectures
+};
+
+// enum Architecture above and kKnownArchitectures below
+// must be kept in sync.
+const NXArchInfo kKnownArchitectures[] = {
+  {
+    "i386",
+    CPU_TYPE_I386,
+    CPU_SUBTYPE_I386_ALL,
+    NX_LittleEndian,
+    "Intel 80x86"
+  },
+  {
+    "x86_64",
+    CPU_TYPE_X86_64,
+    CPU_SUBTYPE_X86_64_ALL,
+    NX_LittleEndian,
+    "Intel x86-64"
+  },
+  {
+    "arm",
+    CPU_TYPE_ARM,
+    CPU_SUBTYPE_ARM_ALL,
+    NX_LittleEndian,
+    "ARM"
+  },
+  {
+    "arm64",
+    CPU_TYPE_ARM64,
+    CPU_SUBTYPE_ARM64_ALL,
+    NX_LittleEndian,
+    "ARM64"
+  },
+  {
+    "ppc",
+    CPU_TYPE_POWERPC,
+    CPU_SUBTYPE_POWERPC_ALL,
+    NX_BigEndian,
+    "PowerPC"
+  }
+};
+
+}  // namespace
+
+const NXArchInfo *NXGetLocalArchInfo(void) {
+  Architecture arch;
+#if defined(__i386__)
+  arch = kArch_i386;
+#elif defined(__x86_64__)
+  arch = kArch_x86_64;
+#elif defined(__arm64)
+  arch = kArch_arm64;
+#elif defined(__arm__)
+  arch = kArch_arm;
+#elif defined(__powerpc__)
+  arch = kArch_ppc;
+#else
+  #error "Unsupported CPU architecture"
+#endif
+  return &kKnownArchitectures[arch];
+}
+
+const NXArchInfo *NXGetArchInfoFromName(const char *name) {
+  for (int arch = 0; arch < kNumArchitectures; ++arch) {
+    if (!strcmp(name, kKnownArchitectures[arch].name)) {
+      return &kKnownArchitectures[arch];
+    }
+  }
+  return nullptr;
+}
+
+const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
+                                           cpu_subtype_t cpusubtype) {
+  for (int arch = 0; arch < kNumArchitectures; ++arch) {
+    if (kKnownArchitectures[arch].cputype == cputype) {
+      return &kKnownArchitectures[arch];
+    }
+  }
+  return nullptr;
+}
+
+struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
+                                   cpu_subtype_t cpusubtype,
+                                   struct fat_arch *fat_archs,
+                                   uint32_t nfat_archs) {
+  for (uint32_t f = 0; f < nfat_archs; ++f) {
+    if (fat_archs[f].cputype == cputype) {
+      return &fat_archs[f];
+    }
+  }
+  return nullptr;
+}
+#endif  // !__APPLE__
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/byteswap.h
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/byteswap.h
@@ -31,18 +31,43 @@
 
 // Original author: Jim Blandy <jim@mozilla.com> <jimb@red-bean.com>
 
 // byteswap.h: Overloaded functions for conveniently byteswapping values.
 
 #ifndef COMMON_MAC_BYTESWAP_H_
 #define COMMON_MAC_BYTESWAP_H_
 
+#ifdef __APPLE__
 #include <libkern/OSByteOrder.h>
 
 static inline uint16_t ByteSwap(uint16_t v) { return OSSwapInt16(v); }
 static inline uint32_t ByteSwap(uint32_t v) { return OSSwapInt32(v); }
 static inline uint64_t ByteSwap(uint64_t v) { return OSSwapInt64(v); }
 static inline int16_t  ByteSwap(int16_t  v) { return OSSwapInt16(v); }
 static inline int32_t  ByteSwap(int32_t  v) { return OSSwapInt32(v); }
 static inline int64_t  ByteSwap(int64_t  v) { return OSSwapInt64(v); }
 
+#elif defined(__linux__)
+// For NXByteOrder
+#include <architecture/byte_order.h>
+#include <stdint.h>
+#include <endian.h>
+#include_next <byteswap.h>
+
+static inline uint16_t ByteSwap(uint16_t v) { return bswap_16(v); }
+static inline uint32_t ByteSwap(uint32_t v) { return bswap_32(v); }
+static inline uint64_t ByteSwap(uint64_t v) { return bswap_64(v); }
+static inline int16_t  ByteSwap(int16_t  v) { return bswap_16(v); }
+static inline int32_t  ByteSwap(int32_t  v) { return bswap_32(v); }
+static inline int64_t  ByteSwap(int64_t  v) { return bswap_64(v); }
+
+static inline NXByteOrder NXHostByteOrder() {
+#ifdef __LITTLE_ENDIAN
+  return NX_LittleEndian;
+#else
+  return NX_BigEndian;
+#endif
+}
+
+#endif  // __APPLE__
+
 #endif  // COMMON_MAC_BYTESWAP_H_
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/dump_syms.cc
@@ -0,0 +1,556 @@
+// -*- mode: c++ -*-
+
+// Copyright (c) 2011, 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.
+
+// Author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
+
+// dump_syms.mm: Create a symbol file for use with minidumps
+
+#include "common/mac/dump_syms.h"
+
+#include <assert.h>
+#include <dirent.h>
+#include <errno.h>
+#include <libgen.h>
+#include <mach-o/arch.h>
+#include <mach-o/fat.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <ostream>
+#include <string>
+#include <vector>
+
+#include "common/dwarf/bytereader-inl.h"
+#include "common/dwarf/dwarf2reader.h"
+#include "common/dwarf_cfi_to_module.h"
+#include "common/dwarf_cu_to_module.h"
+#include "common/dwarf_line_to_module.h"
+#include "common/mac/file_id.h"
+#include "common/mac/arch_utilities.h"
+#include "common/mac/macho_reader.h"
+#include "common/module.h"
+#include "common/scoped_ptr.h"
+#include "common/stabs_reader.h"
+#include "common/stabs_to_module.h"
+#include "common/symbol_data.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;
+using google_breakpad::FileID;
+using google_breakpad::mach_o::FatReader;
+using google_breakpad::mach_o::Section;
+using google_breakpad::mach_o::Segment;
+using google_breakpad::Module;
+using google_breakpad::StabsReader;
+using google_breakpad::StabsToModule;
+using google_breakpad::scoped_ptr;
+using std::make_pair;
+using std::pair;
+using std::string;
+using std::vector;
+
+namespace {
+// Return a vector<string> with absolute paths to all the entries
+// in directory (excluding . and ..).
+vector<string> list_directory(const string& directory) {
+  vector<string> entries;
+  DIR* dir = opendir(directory.c_str());
+  if (!dir) {
+    return entries;
+  }
+
+  string path = directory;
+  if (path[path.length() - 1] != '/') {
+    path += '/';
+  }
+
+  struct dirent* entry = NULL;
+  while ((entry = readdir(dir))) {
+    if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) {
+      entries.push_back(path + entry->d_name);
+    }
+  }
+
+  closedir(dir);
+  return entries;
+}
+}
+
+namespace google_breakpad {
+
+bool DumpSymbols::Read(const string &filename) {
+  struct stat st;
+  if (stat(filename.c_str(), &st) == -1) {
+    fprintf(stderr, "Could not access object file %s: %s\n",
+            filename.c_str(), strerror(errno));
+    return false;
+  }
+
+  input_pathname_ = filename;
+
+  // Does this filename refer to a dSYM bundle?
+  string contents_path = input_pathname_ + "/Contents/Resources/DWARF";
+  if (S_ISDIR(st.st_mode) &&
+      access(contents_path.c_str(), F_OK) == 0) {
+    // If there's one file under Contents/Resources/DWARF then use that,
+    // otherwise bail out.
+    const vector<string> entries = list_directory(contents_path);
+    if (entries.size() == 0) {
+      fprintf(stderr, "Unable to find DWARF-bearing file in bundle: %s\n",
+              input_pathname_.c_str());
+      return false;
+    }
+    if (entries.size() > 1) {
+      fprintf(stderr, "Too many DWARF files in bundle: %s\n",
+              input_pathname_.c_str());
+      return false;
+    }
+
+    object_filename_ = entries[0];
+  } else {
+    object_filename_ = input_pathname_;
+  }
+
+  // Read the file's contents into memory.
+  bool read_ok = true;
+  string error;
+  if (stat(object_filename_.c_str(), &st) != -1) {
+    FILE* f = fopen(object_filename_.c_str(), "rb");
+    if (f) {
+      contents_.reset(new uint8_t[st.st_size]);
+      off_t total = 0;
+      while (total < st.st_size && !feof(f)) {
+        size_t read = fread(&contents_[0] + total, 1, st.st_size - total, f);
+        if (read == 0) {
+          if (ferror(f)) {
+            read_ok = false;
+            error = strerror(errno);
+          }
+          break;
+        }
+        total += read;
+      }
+      fclose(f);
+    } else {
+      error = strerror(errno);
+    }
+  }
+
+  if (!read_ok) {
+    fprintf(stderr, "Error reading object file: %s: %s\n",
+            object_filename_.c_str(),
+            error.c_str());
+    return false;
+  }
+
+  // Get the list of object files present in the file.
+  FatReader::Reporter fat_reporter(object_filename_);
+  FatReader fat_reader(&fat_reporter);
+  if (!fat_reader.Read(&contents_[0],
+                       st.st_size)) {
+    return false;
+  }
+
+  // Get our own copy of fat_reader's object file list.
+  size_t object_files_count;
+  const struct fat_arch *object_files =
+    fat_reader.object_files(&object_files_count);
+  if (object_files_count == 0) {
+    fprintf(stderr, "Fat binary file contains *no* architectures: %s\n",
+            object_filename_.c_str());
+    return false;
+  }
+  object_files_.resize(object_files_count);
+  memcpy(&object_files_[0], object_files,
+         sizeof(struct fat_arch) * object_files_count);
+
+  return true;
+}
+
+bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type,
+                                  cpu_subtype_t cpu_subtype) {
+  // Find the best match for the architecture the user requested.
+  const struct fat_arch *best_match
+    = NXFindBestFatArch(cpu_type, cpu_subtype, &object_files_[0],
+                        static_cast<uint32_t>(object_files_.size()));
+  if (!best_match) return false;
+
+  // Record the selected object file.
+  selected_object_file_ = best_match;
+  return true;
+}
+
+bool DumpSymbols::SetArchitecture(const std::string &arch_name) {
+  bool arch_set = false;
+  const NXArchInfo *arch_info =
+      google_breakpad::BreakpadGetArchInfoFromName(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_.c_str());
+  unsigned char identifier_bytes[16];
+  cpu_type_t cpu_type = selected_object_file_->cputype;
+  cpu_subtype_t cpu_subtype = selected_object_file_->cpusubtype;
+  if (!file_id.MachoIdentifier(cpu_type, cpu_subtype, identifier_bytes)) {
+    fprintf(stderr, "Unable to calculate UUID of mach-o binary %s!\n",
+            object_filename_.c_str());
+    return "";
+  }
+
+  char identifier_string[40];
+  FileID::ConvertIdentifierToString(identifier_bytes, identifier_string,
+                                    sizeof(identifier_string));
+
+  string compacted(identifier_string);
+  for(size_t i = compacted.find('-'); i != string::npos;
+      i = compacted.find('-', i))
+    compacted.erase(i, 1);
+
+  return compacted;
+}
+
+// A line-to-module loader that accepts line number info parsed by
+// dwarf2reader::LineInfo and populates a Module and a line vector
+// with the results.
+class DumpSymbols::DumperLineToModule:
+      public DwarfCUToModule::LineToModuleHandler {
+ public:
+  // Create a line-to-module converter using BYTE_READER.
+  DumperLineToModule(dwarf2reader::ByteReader *byte_reader)
+      : byte_reader_(byte_reader) { }
+
+  void StartCompilationUnit(const string& compilation_dir) {
+    compilation_dir_ = compilation_dir;
+  }
+
+  void ReadProgram(const char *program, uint64 length,
+                   Module *module, vector<Module::Line> *lines) {
+    DwarfLineToModule handler(module, compilation_dir_, lines);
+    dwarf2reader::LineInfo parser(program, length, byte_reader_, &handler);
+    parser.Start();
+  }
+ private:
+  string compilation_dir_;
+  dwarf2reader::ByteReader *byte_reader_;  // WEAK
+};
+
+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()
+                         ? dwarf2reader::ENDIANNESS_BIG
+                         : dwarf2reader::ENDIANNESS_LITTLE);
+
+  // Construct a context for this file.
+  DwarfCUToModule::FileContext file_context(selected_object_name_,
+                                            module);
+
+  // Build a dwarf2reader::SectionMap from our mach_o::SectionMap.
+  for (mach_o::SectionMap::const_iterator it = dwarf_sections.begin();
+       it != dwarf_sections.end(); it++) {
+    file_context.section_map[it->first] =
+      make_pair(reinterpret_cast<const char *>(it->second.contents.start),
+                it->second.contents.Size());
+  }
+
+  // Find the __debug_info section.
+  std::pair<const char *, uint64> debug_info_section
+      = file_context.section_map["__debug_info"];
+  // 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());
+    return false;
+  }
+
+  // Build a line-to-module loader for the root handler to use.
+  DumperLineToModule line_to_module(&byte_reader);
+
+  // Walk the __debug_info section, one compilation unit at a time.
+  uint64 debug_info_length = debug_info_section.second;
+  for (uint64 offset = 0; offset < debug_info_length;) {
+    // Make a handler for the root DIE that populates MODULE with the
+    // debug info.
+    DwarfCUToModule::WarningReporter reporter(selected_object_name_,
+                                              offset);
+    DwarfCUToModule root_handler(&file_context, &line_to_module, &reporter);
+    // Make a Dwarf2Handler that drives our DIEHandler.
+    dwarf2reader::DIEDispatcher die_dispatcher(&root_handler);
+    // Make a DWARF parser for the compilation unit at OFFSET.
+    dwarf2reader::CompilationUnit dwarf_reader(file_context.section_map,
+                                               offset,
+                                               &byte_reader,
+                                               &die_dispatcher);
+    // Process the entire compilation unit; get the offset of the next.
+    offset += dwarf_reader.Start();
+  }
+
+  return true;
+}
+
+bool DumpSymbols::ReadCFI(google_breakpad::Module *module,
+                          const mach_o::Reader &macho_reader,
+                          const mach_o::Section &section,
+                          bool eh_frame) const {
+  // Find the appropriate set of register names for this file's
+  // architecture.
+  vector<const UniqueString*> register_names;
+  switch (macho_reader.cpu_type()) {
+    case CPU_TYPE_X86:
+      register_names = DwarfCFIToModule::RegisterNames::I386();
+      break;
+    case CPU_TYPE_X86_64:
+      register_names = DwarfCFIToModule::RegisterNames::X86_64();
+      break;
+    case CPU_TYPE_ARM:
+      register_names = DwarfCFIToModule::RegisterNames::ARM();
+      break;
+    default: {
+      const NXArchInfo *arch = google_breakpad::BreakpadGetArchInfoFromCpuType(
+          macho_reader.cpu_type(), macho_reader.cpu_subtype());
+      fprintf(stderr, "%s: cannot convert DWARF call frame information for ",
+              selected_object_name_.c_str());
+      if (arch)
+        fprintf(stderr, "architecture '%s'", arch->name);
+      else
+        fprintf(stderr, "architecture %d,%d",
+                macho_reader.cpu_type(), macho_reader.cpu_subtype());
+      fprintf(stderr, " to Breakpad symbol file: no register name table\n");
+      return false;
+    }
+  }
+
+  // Find the call frame information and its size.
+  const char *cfi = reinterpret_cast<const char *>(section.contents.start);
+  size_t cfi_size = section.contents.Size();
+
+  // Plug together the parser, handler, and their entourages.
+  DwarfCFIToModule::Reporter module_reporter(selected_object_name_,
+                                             section.section_name);
+  DwarfCFIToModule handler(module, register_names, &module_reporter);
+  dwarf2reader::ByteReader byte_reader(macho_reader.big_endian() ?
+                                       dwarf2reader::ENDIANNESS_BIG :
+                                       dwarf2reader::ENDIANNESS_LITTLE);
+  byte_reader.SetAddressSize(macho_reader.bits_64() ? 8 : 4);
+  // At the moment, according to folks at Apple and some cursory
+  // 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,
+                                     &byte_reader, &handler, &dwarf_reporter,
+                                     eh_frame);
+  parser.Start();
+  return true;
+}
+
+// A LoadCommandHandler that loads whatever debugging data it finds into a
+// Module.
+class DumpSymbols::LoadCommandDumper:
+      public mach_o::Reader::LoadCommandHandler {
+ public:
+  // Create a load command dumper handling load commands from READER's
+  // file, and adding data to MODULE.
+  LoadCommandDumper(const DumpSymbols &dumper,
+                    google_breakpad::Module *module,
+                    const mach_o::Reader &reader,
+                    SymbolData symbol_data)
+      : dumper_(dumper),
+        module_(module),
+        reader_(reader),
+        symbol_data_(symbol_data) { }
+
+  bool SegmentCommand(const mach_o::Segment &segment);
+  bool SymtabCommand(const ByteBuffer &entries, const ByteBuffer &strings);
+
+ private:
+  const DumpSymbols &dumper_;
+  google_breakpad::Module *module_;  // WEAK
+  const mach_o::Reader &reader_;
+  const SymbolData symbol_data_;
+};
+
+bool DumpSymbols::LoadCommandDumper::SegmentCommand(const Segment &segment) {
+  mach_o::SectionMap section_map;
+  if (!reader_.MapSegmentSections(segment, &section_map))
+    return false;
+
+  if (segment.name == "__TEXT" && symbol_data_ != NO_CFI) {
+    module_->SetLoadAddress(segment.vmaddr);
+    mach_o::SectionMap::const_iterator eh_frame =
+        section_map.find("__eh_frame");
+    if (eh_frame != section_map.end()) {
+      // If there is a problem reading this, don't treat it as a fatal error.
+      dumper_.ReadCFI(module_, reader_, eh_frame->second, true);
+    }
+    return true;
+  }
+
+  if (segment.name == "__DWARF") {
+    if (symbol_data_ != ONLY_CFI) {
+      if (!dumper_.ReadDwarf(module_, reader_, section_map))
+        return false;
+    }
+    if (symbol_data_ != NO_CFI) {
+      mach_o::SectionMap::const_iterator debug_frame
+          = section_map.find("__debug_frame");
+      if (debug_frame != section_map.end()) {
+        // If there is a problem reading this, don't treat it as a fatal error.
+        dumper_.ReadCFI(module_, reader_, debug_frame->second, false);
+      }
+    }
+  }
+
+  return true;
+}
+
+bool DumpSymbols::LoadCommandDumper::SymtabCommand(const ByteBuffer &entries,
+                                                   const ByteBuffer &strings) {
+  StabsToModule stabs_to_module(module_);
+  // Mac OS X STABS are never "unitized", and the size of the 'value' field
+  // matches the address size of the executable.
+  StabsReader stabs_reader(entries.start, entries.Size(),
+                           strings.start, strings.Size(),
+                           reader_.big_endian(),
+                           reader_.bits_64() ? 8 : 4,
+                           true,
+                           &stabs_to_module);
+  if (!stabs_reader.Process())
+    return false;
+  stabs_to_module.Finalize();
+  return true;
+}
+
+bool DumpSymbols::ReadSymbolData(Module** out_module) {
+  // Select an object file, if SetArchitecture hasn't been called to set one
+  // explicitly.
+  if (!selected_object_file_) {
+    // If there's only one architecture, that's the one.
+    if (object_files_.size() == 1)
+      selected_object_file_ = &object_files_[0];
+    else {
+      // Look for an object file whose architecture matches our own.
+      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; specify an architecture explicitly"
+                " with '-a ARCH' to resolve the ambiguity\n",
+                object_filename_.c_str());
+        return false;
+      }
+    }
+  }
+
+  assert(selected_object_file_);
+
+  // Find the name of the selected file's architecture, to appear in
+  // the MODULE record and in error messages.
+  const NXArchInfo *selected_arch_info =
+      google_breakpad::BreakpadGetArchInfoFromCpuType(
+          selected_object_file_->cputype, selected_object_file_->cpusubtype);
+
+  const char *selected_arch_name = selected_arch_info->name;
+  if (strcmp(selected_arch_name, "i386") == 0)
+    selected_arch_name = "x86";
+
+  // Produce a name to use in error messages that includes the
+  // filename, and the architecture, if there is more than one.
+  selected_object_name_ = object_filename_;
+  if (object_files_.size() > 1) {
+    selected_object_name_ += ", architecture ";
+    selected_object_name_ + selected_arch_name;
+  }
+
+  // Compute a module name, to appear in the MODULE record.
+  string module_name = object_filename_;
+  module_name = basename(&module_name[0]);
+
+  // Choose an identifier string, to appear in the MODULE record.
+  string identifier = Identifier();
+  if (identifier.empty())
+    return false;
+  identifier += "0";
+
+  // Create a module to hold the debugging information.
+  scoped_ptr<Module> module(new Module(module_name,
+                                       "mac",
+                                       selected_arch_name,
+                                       identifier));
+
+  // Parse the selected object file.
+  mach_o::Reader::Reporter reporter(selected_object_name_);
+  mach_o::Reader reader(&reporter);
+  if (!reader.Read(&contents_[0]
+                   + selected_object_file_->offset,
+                   selected_object_file_->size,
+                   selected_object_file_->cputype,
+                   selected_object_file_->cpusubtype))
+    return false;
+
+  // Walk its load commands, and deal with whatever is there.
+  LoadCommandDumper load_command_dumper(*this, module.get(), reader,
+                                        symbol_data_);
+  if (!reader.WalkLoadCommands(&load_command_dumper))
+    return false;
+
+  *out_module = module.release();
+
+  return true;
+}
+
+bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
+  Module* module = NULL;
+
+  if (ReadSymbolData(&module) && module) {
+    bool res = module->Write(stream, symbol_data_);
+    delete module;
+    return res;
+  }
+
+  return false;
+}
+
+}  // namespace google_breakpad
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/dump_syms.h
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/dump_syms.h
@@ -30,56 +30,49 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 // Author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
 
 // dump_syms.h: Declaration of google_breakpad::DumpSymbols, a class for
 // reading debugging information from Mach-O files and writing it out as a
 // Breakpad symbol file.
 
-#include <Foundation/Foundation.h>
 #include <mach-o/loader.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <ostream>
 #include <string>
 #include <vector>
 
 #include "common/byte_cursor.h"
 #include "common/mac/macho_reader.h"
 #include "common/module.h"
+#include "common/scoped_ptr.h"
 #include "common/symbol_data.h"
 
 namespace google_breakpad {
 
 class DumpSymbols {
  public:
   explicit DumpSymbols(SymbolData symbol_data)
       : symbol_data_(symbol_data),
         input_pathname_(),
         object_filename_(),
         contents_(),
         selected_object_file_(),
         selected_object_name_() { }
   ~DumpSymbols() {
-    [input_pathname_ release];
-    [object_filename_ release];
-    [contents_ release];
   }
 
   // Prepare to read debugging information from |filename|. |filename| may be
   // the name of a universal binary, a Mach-O file, or a dSYM bundle
   // containing either of the above. On success, return true; if there is a
   // problem reading |filename|, report it and return false.
-  //
-  // (This class uses NSString for filenames and related values,
-  // because the Mac Foundation framework seems to support
-  // filename-related operations more fully on NSString values.)
-  bool Read(NSString *filename);
+  bool Read(const std::string &filename);
 
   // If this dumper's file includes an object file for |cpu_type| and
   // |cpu_subtype|, 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
@@ -146,26 +139,26 @@ class DumpSymbols {
                const mach_o::Section &section,
                bool eh_frame) const;
 
   // The selection of what type of symbol data to read/write.
   const SymbolData symbol_data_;
 
   // The name of the file or bundle whose symbols this will dump.
   // This is the path given to Read, for use in error messages.
-  NSString *input_pathname_;
+  std::string input_pathname_;
 
   // The name of the file this DumpSymbols will actually read debugging
   // information from. Normally, this is the same as input_pathname_, but if
   // filename refers to a dSYM bundle, then this is the resource file
   // within that bundle.
-  NSString *object_filename_;
+  std::string object_filename_;
 
   // The complete contents of object_filename_, mapped into memory.
-  NSData *contents_;
+  scoped_array<uint8_t> contents_;
 
   // A vector of fat_arch structures describing the object files
   // object_filename_ contains. If object_filename_ refers to a fat binary,
   // this may have more than one element; if it refers to a Mach-O file, this
   // has exactly one element.
   vector<struct fat_arch> object_files_;
 
   // The object file in object_files_ selected to dump, or NULL if
deleted file mode 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/dump_syms.mm
+++ /dev/null
@@ -1,533 +0,0 @@
-// -*- mode: c++ -*-
-
-// Copyright (c) 2011, 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.
-
-// Author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
-
-// dump_syms.mm: Create a symbol file for use with minidumps
-
-#include "common/mac/dump_syms.h"
-
-#include <Foundation/Foundation.h>
-#include <mach-o/arch.h>
-#include <mach-o/fat.h>
-#include <stdio.h>
-
-#include <ostream>
-#include <string>
-#include <vector>
-
-#include "common/dwarf/bytereader-inl.h"
-#include "common/dwarf/dwarf2reader.h"
-#include "common/dwarf_cfi_to_module.h"
-#include "common/dwarf_cu_to_module.h"
-#include "common/dwarf_line_to_module.h"
-#include "common/mac/file_id.h"
-#include "common/mac/arch_utilities.h"
-#include "common/mac/macho_reader.h"
-#include "common/module.h"
-#include "common/scoped_ptr.h"
-#include "common/stabs_reader.h"
-#include "common/stabs_to_module.h"
-#include "common/symbol_data.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;
-using google_breakpad::FileID;
-using google_breakpad::mach_o::FatReader;
-using google_breakpad::mach_o::Section;
-using google_breakpad::mach_o::Segment;
-using google_breakpad::Module;
-using google_breakpad::StabsReader;
-using google_breakpad::StabsToModule;
-using google_breakpad::scoped_ptr;
-using std::make_pair;
-using std::pair;
-using std::string;
-using std::vector;
-
-namespace google_breakpad {
-
-bool DumpSymbols::Read(NSString *filename) {
-  if (![[NSFileManager defaultManager] fileExistsAtPath:filename]) {
-    fprintf(stderr, "Object file does not exist: %s\n",
-            [filename fileSystemRepresentation]);
-    return false;
-  }
-
-  input_pathname_ = [filename retain];
-
-  // Does this filename refer to a dSYM bundle?
-  NSBundle *bundle = [NSBundle bundleWithPath:input_pathname_];
-
-  if (bundle) {
-    // Filenames referring to bundles usually have names of the form
-    // "<basename>.dSYM"; however, if the user has specified a wrapper
-    // suffix (the WRAPPER_SUFFIX and WRAPPER_EXTENSION build settings),
-    // then the name may have the form "<basename>.<extension>.dSYM". In
-    // either case, the resource name for the file containing the DWARF
-    // info within the bundle is <basename>.
-    //
-    // Since there's no way to tell how much to strip off, remove one
-    // extension at a time, and use the first one that
-    // 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]);
-        return false;
-      }
-
-      // Take the shortened result as our new base_name.
-      base_name = new_base_name;
-
-      // Try to find a DWARF resource in the bundle under the new base_name.
-      dwarf_resource = [bundle pathForResource:base_name
-                        ofType:nil inDirectory:@"DWARF"];
-    } while (!dwarf_resource);
-
-    object_filename_ = [dwarf_resource retain];
-  } else {
-    object_filename_ = [input_pathname_ retain];
-  }
-
-  // Read the file's contents into memory.
-  //
-  // The documentation for dataWithContentsOfMappedFile says:
-  //
-  //     Because of file mapping restrictions, this method should only be
-  //     used if the file is guaranteed to exist for the duration of the
-  //     data object’s existence. It is generally safer to use the
-  //     dataWithContentsOfFile: method.
-  //
-  // I gather this means that OS X doesn't have (or at least, that method
-  // doesn't use) a form of mapping like Linux's MAP_PRIVATE, where the
-  // process appears to get its own copy of the data, and changes to the
-  // file don't affect memory and vice versa).
-  NSError *error;
-  contents_ = [NSData dataWithContentsOfFile:object_filename_
-                                     options:0
-                                       error:&error];
-  if (!contents_) {
-    fprintf(stderr, "Error reading object file: %s: %s\n",
-            [object_filename_ fileSystemRepresentation],
-            [[error localizedDescription] UTF8String]);
-    return false;
-  }
-  [contents_ retain];
-
-  // Get the list of object files present in the file.
-  FatReader::Reporter fat_reporter([object_filename_
-                                    fileSystemRepresentation]);
-  FatReader fat_reader(&fat_reporter);
-  if (!fat_reader.Read(reinterpret_cast<const uint8_t *>([contents_ bytes]),
-                       [contents_ length])) {
-    return false;
-  }
-
-  // Get our own copy of fat_reader's object file list.
-  size_t object_files_count;
-  const struct fat_arch *object_files =
-    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]);
-    return false;
-  }
-  object_files_.resize(object_files_count);
-  memcpy(&object_files_[0], object_files,
-         sizeof(struct fat_arch) * object_files_count);
-
-  return true;
-}
-
-bool DumpSymbols::SetArchitecture(cpu_type_t cpu_type,
-                                  cpu_subtype_t cpu_subtype) {
-  // Find the best match for the architecture the user requested.
-  const struct fat_arch *best_match
-    = NXFindBestFatArch(cpu_type, cpu_subtype, &object_files_[0],
-                        static_cast<uint32_t>(object_files_.size()));
-  if (!best_match) return false;
-
-  // Record the selected object file.
-  selected_object_file_ = best_match;
-  return true;
-}
-
-bool DumpSymbols::SetArchitecture(const std::string &arch_name) {
-  bool arch_set = false;
-  const NXArchInfo *arch_info =
-      google_breakpad::BreakpadGetArchInfoFromName(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];
-  cpu_type_t cpu_type = selected_object_file_->cputype;
-  cpu_subtype_t cpu_subtype = selected_object_file_->cpusubtype;
-  if (!file_id.MachoIdentifier(cpu_type, cpu_subtype, identifier_bytes)) {
-    fprintf(stderr, "Unable to calculate UUID of mach-o binary %s!\n",
-            [object_filename_ fileSystemRepresentation]);
-    return "";
-  }
-
-  char identifier_string[40];
-  FileID::ConvertIdentifierToString(identifier_bytes, identifier_string,
-                                    sizeof(identifier_string));
-
-  string compacted(identifier_string);
-  for(size_t i = compacted.find('-'); i != string::npos;
-      i = compacted.find('-', i))
-    compacted.erase(i, 1);
-
-  return compacted;
-}
-
-// A line-to-module loader that accepts line number info parsed by
-// dwarf2reader::LineInfo and populates a Module and a line vector
-// with the results.
-class DumpSymbols::DumperLineToModule:
-      public DwarfCUToModule::LineToModuleHandler {
- public:
-  // Create a line-to-module converter using BYTE_READER.
-  DumperLineToModule(dwarf2reader::ByteReader *byte_reader)
-      : byte_reader_(byte_reader) { }
-
-  void StartCompilationUnit(const string& compilation_dir) {
-    compilation_dir_ = compilation_dir;
-  }
-
-  void ReadProgram(const char *program, uint64 length,
-                   Module *module, vector<Module::Line> *lines) {
-    DwarfLineToModule handler(module, compilation_dir_, lines);
-    dwarf2reader::LineInfo parser(program, length, byte_reader_, &handler);
-    parser.Start();
-  }
- private:
-  string compilation_dir_;
-  dwarf2reader::ByteReader *byte_reader_;  // WEAK
-};
-
-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()
-                         ? dwarf2reader::ENDIANNESS_BIG
-                         : dwarf2reader::ENDIANNESS_LITTLE);
-
-  // Construct a context for this file.
-  DwarfCUToModule::FileContext file_context(selected_object_name_,
-                                            module);
-
-  // Build a dwarf2reader::SectionMap from our mach_o::SectionMap.
-  for (mach_o::SectionMap::const_iterator it = dwarf_sections.begin();
-       it != dwarf_sections.end(); it++) {
-    file_context.section_map[it->first] =
-      make_pair(reinterpret_cast<const char *>(it->second.contents.start),
-                it->second.contents.Size());
-  }
-
-  // Find the __debug_info section.
-  std::pair<const char *, uint64> debug_info_section
-      = file_context.section_map["__debug_info"];
-  // 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());
-    return false;
-  }
-
-  // Build a line-to-module loader for the root handler to use.
-  DumperLineToModule line_to_module(&byte_reader);
-
-  // Walk the __debug_info section, one compilation unit at a time.
-  uint64 debug_info_length = debug_info_section.second;
-  for (uint64 offset = 0; offset < debug_info_length;) {
-    // Make a handler for the root DIE that populates MODULE with the
-    // debug info.
-    DwarfCUToModule::WarningReporter reporter(selected_object_name_,
-                                              offset);
-    DwarfCUToModule root_handler(&file_context, &line_to_module, &reporter);
-    // Make a Dwarf2Handler that drives our DIEHandler.
-    dwarf2reader::DIEDispatcher die_dispatcher(&root_handler);
-    // Make a DWARF parser for the compilation unit at OFFSET.
-    dwarf2reader::CompilationUnit dwarf_reader(file_context.section_map,
-                                               offset,
-                                               &byte_reader,
-                                               &die_dispatcher);
-    // Process the entire compilation unit; get the offset of the next.
-    offset += dwarf_reader.Start();
-  }
-
-  return true;
-}
-
-bool DumpSymbols::ReadCFI(google_breakpad::Module *module,
-                          const mach_o::Reader &macho_reader,
-                          const mach_o::Section &section,
-                          bool eh_frame) const {
-  // Find the appropriate set of register names for this file's
-  // architecture.
-  vector<const UniqueString*> register_names;
-  switch (macho_reader.cpu_type()) {
-    case CPU_TYPE_X86:
-      register_names = DwarfCFIToModule::RegisterNames::I386();
-      break;
-    case CPU_TYPE_X86_64:
-      register_names = DwarfCFIToModule::RegisterNames::X86_64();
-      break;
-    case CPU_TYPE_ARM:
-      register_names = DwarfCFIToModule::RegisterNames::ARM();
-      break;
-    default: {
-      const NXArchInfo *arch = google_breakpad::BreakpadGetArchInfoFromCpuType(
-          macho_reader.cpu_type(), macho_reader.cpu_subtype());
-      fprintf(stderr, "%s: cannot convert DWARF call frame information for ",
-              selected_object_name_.c_str());
-      if (arch)
-        fprintf(stderr, "architecture '%s'", arch->name);
-      else
-        fprintf(stderr, "architecture %d,%d",
-                macho_reader.cpu_type(), macho_reader.cpu_subtype());
-      fprintf(stderr, " to Breakpad symbol file: no register name table\n");
-      return false;
-    }
-  }
-
-  // Find the call frame information and its size.
-  const char *cfi = reinterpret_cast<const char *>(section.contents.start);
-  size_t cfi_size = section.contents.Size();
-
-  // Plug together the parser, handler, and their entourages.
-  DwarfCFIToModule::Reporter module_reporter(selected_object_name_,
-                                             section.section_name);
-  DwarfCFIToModule handler(module, register_names, &module_reporter);
-  dwarf2reader::ByteReader byte_reader(macho_reader.big_endian() ?
-                                       dwarf2reader::ENDIANNESS_BIG :
-                                       dwarf2reader::ENDIANNESS_LITTLE);
-  byte_reader.SetAddressSize(macho_reader.bits_64() ? 8 : 4);
-  // At the moment, according to folks at Apple and some cursory
-  // 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,
-                                     &byte_reader, &handler, &dwarf_reporter,
-                                     eh_frame);
-  parser.Start();
-  return true;
-}
-
-// A LoadCommandHandler that loads whatever debugging data it finds into a
-// Module.
-class DumpSymbols::LoadCommandDumper:
-      public mach_o::Reader::LoadCommandHandler {
- public:
-  // Create a load command dumper handling load commands from READER's
-  // file, and adding data to MODULE.
-  LoadCommandDumper(const DumpSymbols &dumper,
-                    google_breakpad::Module *module,
-                    const mach_o::Reader &reader,
-                    SymbolData symbol_data)
-      : dumper_(dumper),
-        module_(module),
-        reader_(reader),
-        symbol_data_(symbol_data) { }
-
-  bool SegmentCommand(const mach_o::Segment &segment);
-  bool SymtabCommand(const ByteBuffer &entries, const ByteBuffer &strings);
-
- private:
-  const DumpSymbols &dumper_;
-  google_breakpad::Module *module_;  // WEAK
-  const mach_o::Reader &reader_;
-  const SymbolData symbol_data_;
-};
-
-bool DumpSymbols::LoadCommandDumper::SegmentCommand(const Segment &segment) {
-  mach_o::SectionMap section_map;
-  if (!reader_.MapSegmentSections(segment, &section_map))
-    return false;
-
-  if (segment.name == "__TEXT" && symbol_data_ != NO_CFI) {
-    module_->SetLoadAddress(segment.vmaddr);
-    mach_o::SectionMap::const_iterator eh_frame =
-        section_map.find("__eh_frame");
-    if (eh_frame != section_map.end()) {
-      // If there is a problem reading this, don't treat it as a fatal error.
-      dumper_.ReadCFI(module_, reader_, eh_frame->second, true);
-    }
-    return true;
-  }
-
-  if (segment.name == "__DWARF") {
-    if (symbol_data_ != ONLY_CFI) {
-      if (!dumper_.ReadDwarf(module_, reader_, section_map))
-        return false;
-    }
-    if (symbol_data_ != NO_CFI) {
-      mach_o::SectionMap::const_iterator debug_frame
-          = section_map.find("__debug_frame");
-      if (debug_frame != section_map.end()) {
-        // If there is a problem reading this, don't treat it as a fatal error.
-        dumper_.ReadCFI(module_, reader_, debug_frame->second, false);
-      }
-    }
-  }
-
-  return true;
-}
-
-bool DumpSymbols::LoadCommandDumper::SymtabCommand(const ByteBuffer &entries,
-                                                   const ByteBuffer &strings) {
-  StabsToModule stabs_to_module(module_);
-  // Mac OS X STABS are never "unitized", and the size of the 'value' field
-  // matches the address size of the executable.
-  StabsReader stabs_reader(entries.start, entries.Size(),
-                           strings.start, strings.Size(),
-                           reader_.big_endian(),
-                           reader_.bits_64() ? 8 : 4,
-                           true,
-                           &stabs_to_module);
-  if (!stabs_reader.Process())
-    return false;
-  stabs_to_module.Finalize();
-  return true;
-}
-
-bool DumpSymbols::ReadSymbolData(Module** out_module) {
-  // Select an object file, if SetArchitecture hasn't been called to set one
-  // explicitly.
-  if (!selected_object_file_) {
-    // If there's only one architecture, that's the one.
-    if (object_files_.size() == 1)
-      selected_object_file_ = &object_files_[0];
-    else {
-      // Look for an object file whose architecture matches our own.
-      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; specify an architecture explicitly"
-                " with '-a ARCH' to resolve the ambiguity\n",
-                [object_filename_ fileSystemRepresentation]);
-        return false;
-      }
-    }
-  }
-
-  assert(selected_object_file_);
-
-  // Find the name of the selected file's architecture, to appear in
-  // the MODULE record and in error messages.
-  const NXArchInfo *selected_arch_info =
-      google_breakpad::BreakpadGetArchInfoFromCpuType(
-          selected_object_file_->cputype, selected_object_file_->cpusubtype);
-
-  const char *selected_arch_name = selected_arch_info->name;
-  if (strcmp(selected_arch_name, "i386") == 0)
-    selected_arch_name = "x86";
-
-  // Produce a name to use in error messages that includes the
-  // filename, and the architecture, if there is more than one.
-  selected_object_name_ = [object_filename_ UTF8String];
-  if (object_files_.size() > 1) {
-    selected_object_name_ += ", architecture ";
-    selected_object_name_ + selected_arch_name;
-  }
-
-  // Compute a module name, to appear in the MODULE record.
-  NSString *module_name = [object_filename_ lastPathComponent];
-
-  // Choose an identifier string, to appear in the MODULE record.
-  string identifier = Identifier();
-  if (identifier.empty())
-    return false;
-  identifier += "0";
-
-  // Create a module to hold the debugging information.
-  scoped_ptr<Module> module(new Module([module_name UTF8String],
-                                       "mac",
-                                       selected_arch_name,
-                                       identifier));
-
-  // Parse the selected object file.
-  mach_o::Reader::Reporter reporter(selected_object_name_);
-  mach_o::Reader reader(&reporter);
-  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))
-    return false;
-
-  // Walk its load commands, and deal with whatever is there.
-  LoadCommandDumper load_command_dumper(*this, module.get(), reader,
-                                        symbol_data_);
-  if (!reader.WalkLoadCommands(&load_command_dumper))
-    return false;
-
-  *out_module = module.release();
-
-  return true;
-}
-
-bool DumpSymbols::WriteSymbolFile(std::ostream &stream) {
-  Module* module = NULL;
-
-  if (ReadSymbolData(&module) && module) {
-    bool res = module->Write(stream, symbol_data_);
-    delete module;
-    return res;
-  }
-
-  return false;
-}
-
-}  // namespace google_breakpad
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/file_id.cc
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/file_id.cc
@@ -40,17 +40,17 @@
 #include "common/mac/file_id.h"
 #include "common/mac/macho_id.h"
 
 using MacFileUtilities::MachoID;
 
 namespace google_breakpad {
 
 FileID::FileID(const char *path) {
-  strlcpy(path_, path, sizeof(path_));
+  strncpy(path_, path, sizeof(path_) - 1);
 }
 
 bool FileID::FileIdentifier(unsigned char identifier[16]) {
   int fd = open(path_, O_RDONLY);
   if (fd == -1)
     return false;
 
   MD5Context md5;
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/macho_id.cc
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/macho_id.cc
@@ -31,17 +31,16 @@
 //
 // See macho_id.h for documentation
 //
 // 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>
 }
 
@@ -56,26 +55,26 @@ using google_breakpad::MD5Update;
 using google_breakpad::MD5Final;
 
 MachoID::MachoID(const char *path)
    : memory_(0),
      memory_size_(0),
      crc_(0), 
      md5_context_(), 
      update_function_(NULL) {
-  strlcpy(path_, path, sizeof(path_));
+  strncpy(path_, path, sizeof(path_) - 1);
 }
 
 MachoID::MachoID(const char *path, void *memory, size_t size)
    : memory_(memory),
      memory_size_(size),
      crc_(0), 
      md5_context_(), 
      update_function_(NULL) {
-  strlcpy(path_, path, sizeof(path_));
+  strncpy(path_, path, sizeof(path_) - 1);
 }
 
 MachoID::~MachoID() {
 }
 
 // The CRC info is from http://en.wikipedia.org/wiki/Adler-32
 // With optimizations from http://www.zlib.net/
 
@@ -256,67 +255,67 @@ bool MachoID::WalkerCB(MachoWalker *walk
 
   if (cmd->cmd == LC_SEGMENT) {
     struct segment_command seg;
 
     if (!walker->ReadBytes(&seg, sizeof(seg), offset))
       return false;
 
     if (swap)
-      swap_segment_command(&seg, NXHostByteOrder());
+      breakpad_swap_segment_command(&seg);
 
     struct mach_header_64 header;
     off_t header_offset;
     
     if (!walker->CurrentHeader(&header, &header_offset))
       return false;
         
     // Process segments that have sections:
     // (e.g., __TEXT, __DATA, __IMPORT, __OBJC)
     offset += sizeof(struct segment_command);
     struct section sec;
     for (unsigned long i = 0; i < seg.nsects; ++i) {
       if (!walker->ReadBytes(&sec, sizeof(sec), 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
       if ((sec.flags & SECTION_TYPE) != S_ZEROFILL && sec.offset != 0)
         macho_id->Update(walker, header_offset + sec.offset, sec.size);
 
       offset += sizeof(struct section);
     }
   } else if (cmd->cmd == LC_SEGMENT_64) {
     struct segment_command_64 seg64;
 
     if (!walker->ReadBytes(&seg64, sizeof(seg64), 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;
     
     if (!walker->CurrentHeader(&header, &header_offset))
       return false;
     
     // Process segments that have sections:
     // (e.g., __TEXT, __DATA, __IMPORT, __OBJC)
     offset += sizeof(struct segment_command_64);
     struct section_64 sec64;
     for (unsigned long i = 0; i < seg64.nsects; ++i) {
       if (!walker->ReadBytes(&sec64, sizeof(sec64), 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
       if ((sec64.flags & SECTION_TYPE) != S_ZEROFILL && sec64.offset != 0)
         macho_id->Update(walker, 
                          header_offset + sec64.offset, 
                          (size_t)sec64.size);
 
@@ -335,17 +334,17 @@ bool MachoID::UUIDWalkerCB(MachoWalker *
     struct breakpad_uuid_command *uuid_cmd =
       (struct breakpad_uuid_command *)context;
 
     if (!walker->ReadBytes(uuid_cmd, sizeof(struct breakpad_uuid_command),
                            offset))
       return false;
 
     if (swap)
-      breakpad_swap_uuid_command(uuid_cmd, NXHostByteOrder());
+      breakpad_swap_uuid_command(uuid_cmd);
 
     return false;
   }
 
   // Continue processing
   return true;
 }
 
@@ -354,17 +353,17 @@ bool MachoID::IDWalkerCB(MachoWalker *wa
                          bool swap, void *context) {
   if (cmd->cmd == LC_ID_DYLIB) {
     struct dylib_command *dylib_cmd = (struct dylib_command *)context;
 
     if (!walker->ReadBytes(dylib_cmd, sizeof(struct dylib_command), offset))
       return false;
 
     if (swap)
-      swap_dylib_command(dylib_cmd, NXHostByteOrder());
+      breakpad_swap_dylib_command(dylib_cmd);
 
     return false;
   }
 
   // Continue processing
   return true;
 }
 
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/macho_utilities.cc
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/macho_utilities.cc
@@ -29,62 +29,127 @@
 
 // macho_utilties.cc: Utilities for dealing with mach-o files
 //
 // Author: Dave Camp
 
 #include "common/mac/byteswap.h"
 #include "common/mac/macho_utilities.h"
 
-void breakpad_swap_uuid_command(struct breakpad_uuid_command *uc,
-                                enum NXByteOrder target_byte_order)
-{
+#include <mach-o/fat.h>
+#include <mach-o/loader.h>
+
+void breakpad_swap_uuid_command(struct breakpad_uuid_command *uc) {
   uc->cmd = ByteSwap(uc->cmd);
   uc->cmdsize = ByteSwap(uc->cmdsize);
 }
 
-void breakpad_swap_segment_command_64(struct segment_command_64 *sg,
-                                      enum NXByteOrder target_byte_order)
-{
+void breakpad_swap_load_command(struct load_command *lc) {
+  lc->cmd = ByteSwap(lc->cmd);
+  lc->cmdsize = ByteSwap(lc->cmdsize);
+}
+
+void breakpad_swap_dylib_command(struct dylib_command *dc) {
+  dc->cmd = ByteSwap(dc->cmd);
+  dc->cmdsize = ByteSwap(dc->cmdsize);
+
+  dc->dylib.name.offset = ByteSwap(dc->dylib.name.offset);
+  dc->dylib.timestamp = ByteSwap(dc->dylib.timestamp);
+  dc->dylib.current_version = ByteSwap(dc->dylib.current_version);
+  dc->dylib.compatibility_version = ByteSwap(dc->dylib.compatibility_version);
+}
+
+void breakpad_swap_segment_command(struct segment_command *sc) {
+  sc->cmd = ByteSwap(sc->cmd);
+  sc->cmdsize = ByteSwap(sc->cmdsize);
+
+  sc->vmaddr = ByteSwap(sc->vmaddr);
+  sc->vmsize = ByteSwap(sc->vmsize);
+  sc->fileoff = ByteSwap(sc->fileoff);
+  sc->filesize = ByteSwap(sc->filesize);
+  sc->maxprot = ByteSwap(sc->maxprot);
+  sc->initprot = ByteSwap(sc->initprot);
+  sc->nsects = ByteSwap(sc->nsects);
+  sc->flags = ByteSwap(sc->flags);
+}
+
+void breakpad_swap_segment_command_64(struct segment_command_64 *sg) {
   sg->cmd = ByteSwap(sg->cmd);
   sg->cmdsize = ByteSwap(sg->cmdsize);
 
   sg->vmaddr = ByteSwap(sg->vmaddr);
   sg->vmsize = ByteSwap(sg->vmsize);
   sg->fileoff = ByteSwap(sg->fileoff);
   sg->filesize = ByteSwap(sg->filesize);
 
   sg->maxprot = ByteSwap(sg->maxprot);
   sg->initprot = ByteSwap(sg->initprot);
   sg->nsects = ByteSwap(sg->nsects);
   sg->flags = ByteSwap(sg->flags);
 }
 
-void breakpad_swap_mach_header_64(struct mach_header_64 *mh,
-                                  enum NXByteOrder target_byte_order)
-{
+void breakpad_swap_fat_header(struct fat_header *fh) {
+  fh->magic = ByteSwap(fh->magic);
+  fh->nfat_arch = ByteSwap(fh->nfat_arch);
+}
+
+void breakpad_swap_fat_arch(struct fat_arch *fa, uint32_t narchs) {
+  for (uint32_t i = 0; i < narchs; ++i) {
+    fa[i].cputype = ByteSwap(fa[i].cputype);
+    fa[i].cpusubtype = ByteSwap(fa[i].cpusubtype);
+    fa[i].offset = ByteSwap(fa[i].offset);
+    fa[i].size = ByteSwap(fa[i].size);
+    fa[i].align = ByteSwap(fa[i].align);
+  }
+}
+
+void breakpad_swap_mach_header(struct mach_header *mh) {
+  mh->magic = ByteSwap(mh->magic);
+  mh->cputype = ByteSwap(mh->cputype);
+  mh->cpusubtype = ByteSwap(mh->cpusubtype);
+  mh->filetype = ByteSwap(mh->filetype);
+  mh->ncmds = ByteSwap(mh->ncmds);
+  mh->sizeofcmds = ByteSwap(mh->sizeofcmds);
+  mh->flags = ByteSwap(mh->flags);
+}
+
+void breakpad_swap_mach_header_64(struct mach_header_64 *mh) {
   mh->magic = ByteSwap(mh->magic);
   mh->cputype = ByteSwap(mh->cputype);
   mh->cpusubtype = ByteSwap(mh->cpusubtype);
   mh->filetype = ByteSwap(mh->filetype);
   mh->ncmds = ByteSwap(mh->ncmds);
   mh->sizeofcmds = ByteSwap(mh->sizeofcmds);
   mh->flags = ByteSwap(mh->flags);
   mh->reserved = ByteSwap(mh->reserved);
 }
 
-void breakpad_swap_section_64(struct section_64 *s,
-                              uint32_t nsects,
-                              enum NXByteOrder target_byte_order)
-{
+void breakpad_swap_section(struct section *s,
+                           uint32_t nsects) {
   for (uint32_t i = 0; i < nsects; i++) {
     s[i].addr = ByteSwap(s[i].addr);
     s[i].size = ByteSwap(s[i].size);
 
     s[i].offset = ByteSwap(s[i].offset);
     s[i].align = ByteSwap(s[i].align);
     s[i].reloff = ByteSwap(s[i].reloff);
     s[i].nreloc = ByteSwap(s[i].nreloc);
     s[i].flags = ByteSwap(s[i].flags);
     s[i].reserved1 = ByteSwap(s[i].reserved1);
     s[i].reserved2 = ByteSwap(s[i].reserved2);
   }
 }
+
+void breakpad_swap_section_64(struct section_64 *s,
+                              uint32_t nsects) {
+  for (uint32_t i = 0; i < nsects; i++) {
+    s[i].addr = ByteSwap(s[i].addr);
+    s[i].size = ByteSwap(s[i].size);
+
+    s[i].offset = ByteSwap(s[i].offset);
+    s[i].align = ByteSwap(s[i].align);
+    s[i].reloff = ByteSwap(s[i].reloff);
+    s[i].nreloc = ByteSwap(s[i].nreloc);
+    s[i].flags = ByteSwap(s[i].flags);
+    s[i].reserved1 = ByteSwap(s[i].reserved1);
+    s[i].reserved2 = ByteSwap(s[i].reserved2);
+  }
+}
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/macho_utilities.h
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/macho_utilities.h
@@ -57,28 +57,39 @@
 // The uuid_command struct/swap routines were added during the 10.4 series.
 // Their presence isn't guaranteed.
 struct breakpad_uuid_command {
   uint32_t    cmd;            /* LC_UUID */
   uint32_t    cmdsize;        /* sizeof(struct uuid_command) */
   uint8_t     uuid[16];       /* the 128-bit uuid */
 };
 
-void breakpad_swap_uuid_command(struct breakpad_uuid_command *uc,
-                                enum NXByteOrder target_byte_order);
+void breakpad_swap_uuid_command(struct breakpad_uuid_command *uc);
+
+void breakpad_swap_load_command(struct load_command *lc);
+
+void breakpad_swap_dylib_command(struct dylib_command *dc);
 
 // Older SDKs defines thread_state_data_t as an int[] instead
 // of the natural_t[] it should be.
 typedef natural_t breakpad_thread_state_data_t[THREAD_STATE_MAX];
 
+void breakpad_swap_segment_command(struct segment_command *sc);
+
 // The 64-bit swap routines were added during the 10.4 series, their
 // presence isn't guaranteed.
-void breakpad_swap_segment_command_64(struct segment_command_64 *sg,
-                                      enum NXByteOrder target_byte_order);
+void breakpad_swap_segment_command_64(struct segment_command_64 *sg);
+
+void breakpad_swap_fat_header(struct fat_header *fh);
+
+void breakpad_swap_fat_arch(struct fat_arch *fa, uint32_t narchs);
 
-void breakpad_swap_mach_header_64(struct mach_header_64 *mh,
-                                  enum NXByteOrder target_byte_order);
+void breakpad_swap_mach_header(struct mach_header *mh);
+
+void breakpad_swap_mach_header_64(struct mach_header_64 *mh);
+
+void breakpad_swap_section(struct section *s,
+                           uint32_t nsects);
 
 void breakpad_swap_section_64(struct section_64 *s,
-                              uint32_t nsects,
-                              enum NXByteOrder target_byte_order);
+                              uint32_t nsects);
 
 #endif
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/macho_walker.cc
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/macho_walker.cc
@@ -32,18 +32,18 @@
 // See macho_walker.h for documentation
 //
 // Author: Dan Waylonis
 
 extern "C" {  // necessary for Leopard
   #include <assert.h>
   #include <fcntl.h>
   #include <mach-o/arch.h>
+  #include <mach-o/fat.h>
   #include <mach-o/loader.h>
-  #include <mach-o/swap.h>
   #include <string.h>
   #include <unistd.h>
 }
 
 #include "common/mac/byteswap.h"
 #include "common/mac/macho_walker.h"
 #include "common/mac/macho_utilities.h"
 
@@ -151,17 +151,17 @@ bool MachoWalker::FindHeader(cpu_type_t 
   if (!is_fat) {
     // If we don't have a fat header, check if the cpu type matches the single
     // header
     struct mach_header header;
     if (!ReadBytes(&header, sizeof(header), 0))
       return false;
 
     if (magic == MH_CIGAM || magic == MH_CIGAM_64)
-      swap_mach_header(&header, NXHostByteOrder());
+      breakpad_swap_mach_header(&header);
 
     if (cpu_type != header.cputype ||
         (cpu_subtype != CPU_SUBTYPE_MULTIPLE &&
          cpu_subtype != header.cpusubtype)) {
       return false;
     }
 
     offset = 0;
@@ -169,28 +169,28 @@ bool MachoWalker::FindHeader(cpu_type_t 
   } else {
     // Read the fat header and find an appropriate architecture
     offset = 0;
     struct fat_header fat;
     if (!ReadBytes(&fat, sizeof(fat), offset))
       return false;
 
     if (NXHostByteOrder() != NX_BigEndian)
-      swap_fat_header(&fat, NXHostByteOrder());
+      breakpad_swap_fat_header(&fat);
 
     offset += sizeof(fat);
 
     // Search each architecture for the desired one
     struct fat_arch arch;
     for (uint32_t i = 0; i < fat.nfat_arch; ++i) {
       if (!ReadBytes(&arch, sizeof(arch), offset))
         return false;
 
       if (NXHostByteOrder() != NX_BigEndian)
-        swap_fat_arch(&arch, 1, NXHostByteOrder());
+        breakpad_swap_fat_arch(&arch, 1);
 
       if (arch.cputype == cpu_type &&
           (cpu_subtype == CPU_SUBTYPE_MULTIPLE ||
            arch.cpusubtype == cpu_subtype)) {
         offset = arch.offset;
         return true;
       }
 
@@ -203,17 +203,17 @@ bool MachoWalker::FindHeader(cpu_type_t 
 
 bool MachoWalker::WalkHeaderAtOffset(off_t offset) {
   struct mach_header header;
   if (!ReadBytes(&header, sizeof(header), offset))
     return false;
 
   bool swap = (header.magic == MH_CIGAM);
   if (swap)
-    swap_mach_header(&header, NXHostByteOrder());
+    breakpad_swap_mach_header(&header);
 
   // Copy the data into the mach_header_64 structure.  Since the 32-bit and
   // 64-bit only differ in the last field (reserved), this is safe to do.
   struct mach_header_64 header64;
   memcpy((void *)&header64, (const void *)&header, sizeof(header));
   header64.reserved = 0;
 
   current_header_ = &header64;
@@ -229,17 +229,17 @@ bool MachoWalker::WalkHeaderAtOffset(off
 
 bool MachoWalker::WalkHeader64AtOffset(off_t offset) {
   struct mach_header_64 header;
   if (!ReadBytes(&header, sizeof(header), offset))
     return false;
 
   bool swap = (header.magic == MH_CIGAM_64);
   if (swap)
-    breakpad_swap_mach_header_64(&header, NXHostByteOrder());
+    breakpad_swap_mach_header_64(&header);
 
   current_header_ = &header;
   current_header_size_ = sizeof(header);
   current_header_offset_ = offset;
   offset += current_header_size_;
   bool result = WalkHeaderCore(offset, header.ncmds, swap);
   current_header_ = NULL;
   current_header_size_ = 0;
@@ -250,17 +250,17 @@ bool MachoWalker::WalkHeader64AtOffset(o
 bool MachoWalker::WalkHeaderCore(off_t offset, uint32_t number_of_commands,
                                  bool swap) {
   for (uint32_t i = 0; i < number_of_commands; ++i) {
     struct load_command cmd;
     if (!ReadBytes(&cmd, sizeof(cmd), offset))
       return false;
 
     if (swap)
-      swap_load_command(&cmd, NXHostByteOrder());
+      breakpad_swap_load_command(&cmd);
 
     // Call the user callback
     if (callback_ && !callback_(this, &cmd, offset, swap, callback_context_))
       break;
 
     offset += cmd.cmdsize;
   }
 
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
@@ -1,38 +1,43 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 UNIFIED_SOURCES += [
     'arch_utilities.cc',
-    'bootstrap_compat.cc',
     'file_id.cc',
     'macho_id.cc',
     'macho_reader.cc',
     'macho_utilities.cc',
     'macho_walker.cc',
-    'string_utilities.cc',
 ]
 
+if CONFIG['HOST_OS_ARCH'] != 'Darwin':
+    HOST_CXXFLAGS += [
+        '-I%s/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/' % TOPSRCDIR,
+    ]
+
 # This is a little weird, but we're building a host and a target lib here.
 # The host lib is used for dump_syms, and the target lib for the
 # crash reporter client.  Therefore, we don't need all the srcs in both.
 if CONFIG['MOZ_CRASHREPORTER']:
     HOST_SOURCES += UNIFIED_SOURCES
     HOST_SOURCES += [
-        'dump_syms.mm',
+        'dump_syms.cc',
     ]
     HostLibrary('host_breakpad_mac_common_s')
 
 SOURCES += [
+    'bootstrap_compat.cc',
     'HTTPMultipartUpload.m',
     'MachIPC.mm',
+    'string_utilities.cc',
 ]
 
 Library('breakpad_mac_common_s')
 
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -11,17 +11,17 @@ UNIFIED_SOURCES += [
     'convert_UTF.c',
     'logging.cc',
     'module.cc',
     'pathname_stripper.cc',
     'string_conversion.cc',
     'unique_string.cc',
 ]
 
-if CONFIG['OS_TARGET'] != 'WINNT':
+if CONFIG['OS_ARCH'] != 'WINNT':
     UNIFIED_SOURCES += [
         'arm_ex_reader.cc',
         'arm_ex_to_module.cc',
         'dwarf/bytereader.cc',
         'dwarf/dwarf2diehandler.cc',
         'dwarf/dwarf2reader.cc',
         'dwarf_cfi_to_module.cc',
         'dwarf_cu_to_module.cc',
@@ -33,48 +33,50 @@ if CONFIG['OS_TARGET'] != 'WINNT':
 if CONFIG['OS_ARCH'] == 'Linux':
     UNIFIED_SOURCES += [
         'linux/dump_symbols.cc',
         'linux/elf_symbols_to_module.cc',
     ]
     HOST_DEFINES['HAVE_A_OUT_H'] = True
     DEFINES['HAVE_A_OUT_H'] = True
 
-if CONFIG['OS_TARGET'] == 'Android':
-    pass
-else:
-    if CONFIG['OS_TARGET'] != 'WINNT':
-        UNIFIED_SOURCES += [
-            'stabs_reader.cc',
-            'stabs_to_module.cc',
-        ]
+if CONFIG['OS_ARCH'] == 'Darwin' and CONFIG['HOST_OS_ARCH'] != 'Darwin':
+    HOST_CXXFLAGS += [
+        '-I%s/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/' % TOPSRCDIR,
+    ]
 
-if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_CRASHREPORTER']:
-    HOST_SOURCES += [ 'convert_UTF.c' ]
-    HostLibrary('host_breakpad_common_s')
+if CONFIG['OS_TARGET'] != 'Android' and CONFIG['OS_ARCH'] != 'WINNT':
+    UNIFIED_SOURCES += [
+        'stabs_reader.cc',
+        'stabs_to_module.cc',
+    ]
+
+if CONFIG['OS_ARCH'] != 'WINNT' and CONFIG['MOZ_CRASHREPORTER']:
     HOST_SOURCES += [
         'arm_ex_reader.cc',
         'arm_ex_to_module.cc',
+        'convert_UTF.c',
         'dwarf_cfi_to_module.cc',
         'dwarf_cu_to_module.cc',
         'dwarf_line_to_module.cc',
         'language.cc',
         'logging.cc',
         'md5.cc',
         'module.cc',
         'pathname_stripper.cc',
         'stabs_reader.cc',
         'stabs_to_module.cc',
         'string_conversion.cc',
         'unique_string.cc',
     ]
+    HostLibrary('host_breakpad_common_s')
 
 if CONFIG['OS_ARCH'] == 'Darwin':
     UNIFIED_SOURCES += [
-        'mac/dump_syms.mm',
+        'mac/dump_syms.cc',
     ]
     HOST_DEFINES['HAVE_MACH_O_NLIST_H'] = True
     DEFINES['HAVE_MACH_O_NLIST_H'] = True
 
 if CONFIG['OS_TARGET'] == 'Android':
     # We don't support unifying assembly files.
     SOURCES += [
         'android/breakpad_getcontext.S',
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/README
@@ -0,0 +1,2 @@
+These headers were copied from the Mac OS X 10.7 SDK to enable building
+the Mac dump_syms code that processes Mach-O files on Linux.
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/architecture/byte_order.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999-2008 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright (c) 1992 NeXT Computer, Inc.
+ *
+ * Byte ordering conversion.
+ *
+ */
+/* This file mostly left blank */
+
+#ifndef _ARCHITECTURE_BYTE_ORDER_H_
+#define _ARCHITECTURE_BYTE_ORDER_H_
+
+/*
+ * Identify the byte order
+ * of the current host.
+ */
+
+enum NXByteOrder {
+    NX_UnknownByteOrder,
+    NX_LittleEndian,
+    NX_BigEndian
+};
+
+#endif  /* _ARCHITECTURE_BYTE_ORDER_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/i386/_types.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+#ifndef	_BSD_I386__TYPES_H_
+#define	_BSD_I386__TYPES_H_
+
+typedef long			__darwin_intptr_t;
+typedef unsigned int		__darwin_natural_t;
+
+#endif	/* _BSD_I386__TYPES_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach-o/arch.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+#ifndef _MACH_O_ARCH_H_
+#define _MACH_O_ARCH_H_
+/*
+ * Copyright (c) 1997 Apple Computer, Inc.
+ *
+ * Functions that deal with information about architectures.
+ *
+ */
+
+#include <stdint.h>
+#include <mach/machine.h>
+#include <architecture/byte_order.h>
+
+/* The NXArchInfo structs contain the architectures symbolic name
+ * (such as "ppc"), its CPU type and CPU subtype as defined in
+ * mach/machine.h, the byte order for the architecture, and a
+ * describing string (such as "PowerPC").
+ * There will both be entries for specific CPUs (such as ppc604e) as
+ * well as generic "family" entries (such as ppc).
+ */
+typedef struct {
+    const char *name;
+    cpu_type_t cputype;
+    cpu_subtype_t cpusubtype;
+    enum NXByteOrder byteorder;
+    const char *description;
+} NXArchInfo;
+
+#if __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* NXGetAllArchInfos() returns a pointer to an array of all known
+ * NXArchInfo structures.  The last NXArchInfo is marked by a NULL name.
+ */
+extern const NXArchInfo *NXGetAllArchInfos(void);
+
+/* NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL
+ * if none is known. 
+ */
+extern const NXArchInfo *NXGetLocalArchInfo(void);
+
+/* NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the
+ * NXArchInfo from the architecture's name or cputype/cpusubtype
+ * combination.  A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used
+ * to request the most general NXArchInfo known for the given cputype.
+ * NULL is returned if no matching NXArchInfo can be found.
+ */
+extern const NXArchInfo *NXGetArchInfoFromName(const char *name);
+extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
+						  cpu_subtype_t cpusubtype);
+
+/* NXFindBestFatArch() is passed a cputype and cpusubtype and a set of
+ * fat_arch structs and selects the best one that matches (if any) and returns
+ * a pointer to that fat_arch struct (or NULL).  The fat_arch structs must be
+ * in the host byte order and correct such that the fat_archs really points to
+ * enough memory for nfat_arch structs.  It is possible that this routine could
+ * fail if new cputypes or cpusubtypes are added and an old version of this
+ * routine is used.  But if there is an exact match between the cputype and
+ * cpusubtype and one of the fat_arch structs this routine will always succeed.
+ */
+extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
+					  cpu_subtype_t cpusubtype,
+					  struct fat_arch *fat_archs,
+					  uint32_t nfat_archs);
+
+/* NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two
+ * different cpusubtypes for the specified cputype.  If the two cpusubtypes
+ * can't be combined (the specific subtypes are mutually exclusive) -1 is
+ * returned indicating it is an error to combine them.  This can also fail and
+ * return -1 if new cputypes or cpusubtypes are added and an old version of
+ * this routine is used.  But if the cpusubtypes are the same they can always
+ * be combined and this routine will return the cpusubtype pass in.
+ */
+extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype,
+					  cpu_subtype_t cpusubtype1,
+					  cpu_subtype_t cpusubtype2);
+
+#if __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _MACH_O_ARCH_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach-o/fat.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+#ifndef _MACH_O_FAT_H_
+#define _MACH_O_FAT_H_
+/*
+ * This header file describes the structures of the file format for "fat"
+ * architecture specific file (wrapper design).  At the begining of the file
+ * there is one fat_header structure followed by a number of fat_arch
+ * structures.  For each architecture in the file, specified by a pair of
+ * cputype and cpusubtype, the fat_header describes the file offset, file
+ * size and alignment in the file of the architecture specific member.
+ * The padded bytes in the file to place each member on it's specific alignment
+ * are defined to be read as zeros and can be left as "holes" if the file system
+ * can support them as long as they read as zeros.
+ *
+ * All structures defined here are always written and read to/from disk
+ * in big-endian order.
+ */
+
+/*
+ * <mach/machine.h> is needed here for the cpu_type_t and cpu_subtype_t types
+ * and contains the constants for the possible values of these types.
+ */
+#include <stdint.h>
+#include <mach/machine.h>
+#include <architecture/byte_order.h>
+
+#define FAT_MAGIC	0xcafebabe
+#define FAT_CIGAM	0xbebafeca	/* NXSwapLong(FAT_MAGIC) */
+
+struct fat_header {
+	uint32_t	magic;		/* FAT_MAGIC */
+	uint32_t	nfat_arch;	/* number of structs that follow */
+};
+
+struct fat_arch {
+	cpu_type_t	cputype;	/* cpu specifier (int) */
+	cpu_subtype_t	cpusubtype;	/* machine specifier (int) */
+	uint32_t	offset;		/* file offset to this object file */
+	uint32_t	size;		/* size of this object file */
+	uint32_t	align;		/* alignment as a power of 2 */
+};
+
+#endif /* _MACH_O_FAT_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach-o/loader.h
@@ -0,0 +1,1402 @@
+/*
+ * Copyright (c) 1999-2010 Apple Inc.  All Rights Reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+#ifndef _MACHO_LOADER_H_
+#define _MACHO_LOADER_H_
+
+/*
+ * This file describes the format of mach object files.
+ */
+#include <stdint.h>
+
+/*
+ * <mach/machine.h> is needed here for the cpu_type_t and cpu_subtype_t types
+ * and contains the constants for the possible values of these types.
+ */
+#include <mach/machine.h>
+
+/*
+ * <mach/vm_prot.h> is needed here for the vm_prot_t type and contains the 
+ * constants that are or'ed together for the possible values of this type.
+ */
+#include <mach/vm_prot.h>
+
+/*
+ * <machine/thread_status.h> is expected to define the flavors of the thread
+ * states and the structures of those flavors for each machine.
+ */
+#include <mach/machine/thread_status.h>
+#include <architecture/byte_order.h>
+
+/*
+ * The 32-bit mach header appears at the very beginning of the object file for
+ * 32-bit architectures.
+ */
+struct mach_header {
+	uint32_t	magic;		/* mach magic number identifier */
+	cpu_type_t	cputype;	/* cpu specifier */
+	cpu_subtype_t	cpusubtype;	/* machine specifier */
+	uint32_t	filetype;	/* type of file */
+	uint32_t	ncmds;		/* number of load commands */
+	uint32_t	sizeofcmds;	/* the size of all the load commands */
+	uint32_t	flags;		/* flags */
+};
+
+/* Constant for the magic field of the mach_header (32-bit architectures) */
+#define	MH_MAGIC	0xfeedface	/* the mach magic number */
+#define MH_CIGAM	0xcefaedfe	/* NXSwapInt(MH_MAGIC) */
+
+/*
+ * The 64-bit mach header appears at the very beginning of object files for
+ * 64-bit architectures.
+ */
+struct mach_header_64 {
+	uint32_t	magic;		/* mach magic number identifier */
+	cpu_type_t	cputype;	/* cpu specifier */
+	cpu_subtype_t	cpusubtype;	/* machine specifier */
+	uint32_t	filetype;	/* type of file */
+	uint32_t	ncmds;		/* number of load commands */
+	uint32_t	sizeofcmds;	/* the size of all the load commands */
+	uint32_t	flags;		/* flags */
+	uint32_t	reserved;	/* reserved */
+};
+
+/* Constant for the magic field of the mach_header_64 (64-bit architectures) */
+#define MH_MAGIC_64 0xfeedfacf /* the 64-bit mach magic number */
+#define MH_CIGAM_64 0xcffaedfe /* NXSwapInt(MH_MAGIC_64) */
+
+/*
+ * The layout of the file depends on the filetype.  For all but the MH_OBJECT
+ * file type the segments are padded out and aligned on a segment alignment
+ * boundary for efficient demand pageing.  The MH_EXECUTE, MH_FVMLIB, MH_DYLIB,
+ * MH_DYLINKER and MH_BUNDLE file types also have the headers included as part
+ * of their first segment.
+ * 
+ * The file type MH_OBJECT is a compact format intended as output of the
+ * assembler and input (and possibly output) of the link editor (the .o
+ * format).  All sections are in one unnamed segment with no segment padding. 
+ * This format is used as an executable format when the file is so small the
+ * segment padding greatly increases its size.
+ *
+ * The file type MH_PRELOAD is an executable format intended for things that
+ * are not executed under the kernel (proms, stand alones, kernels, etc).  The
+ * format can be executed under the kernel but may demand paged it and not
+ * preload it before execution.
+ *
+ * A core file is in MH_CORE format and can be any in an arbritray legal
+ * Mach-O file.
+ *
+ * Constants for the filetype field of the mach_header
+ */
+#define	MH_OBJECT	0x1		/* relocatable object file */
+#define	MH_EXECUTE	0x2		/* demand paged executable file */
+#define	MH_FVMLIB	0x3		/* fixed VM shared library file */
+#define	MH_CORE		0x4		/* core file */
+#define	MH_PRELOAD	0x5		/* preloaded executable file */
+#define	MH_DYLIB	0x6		/* dynamically bound shared library */
+#define	MH_DYLINKER	0x7		/* dynamic link editor */
+#define	MH_BUNDLE	0x8		/* dynamically bound bundle file */
+#define	MH_DYLIB_STUB	0x9		/* shared library stub for static */
+					/*  linking only, no section contents */
+#define	MH_DSYM		0xa		/* companion file with only debug */
+					/*  sections */
+#define	MH_KEXT_BUNDLE	0xb		/* x86_64 kexts */
+
+/* Constants for the flags field of the mach_header */
+#define	MH_NOUNDEFS	0x1		/* the object file has no undefined
+					   references */
+#define	MH_INCRLINK	0x2		/* the object file is the output of an
+					   incremental link against a base file
+					   and can't be link edited again */
+#define MH_DYLDLINK	0x4		/* the object file is input for the
+					   dynamic linker and can't be staticly
+					   link edited again */
+#define MH_BINDATLOAD	0x8		/* the object file's undefined
+					   references are bound by the dynamic
+					   linker when loaded. */
+#define MH_PREBOUND	0x10		/* the file has its dynamic undefined
+					   references prebound. */
+#define MH_SPLIT_SEGS	0x20		/* the file has its read-only and
+					   read-write segments split */
+#define MH_LAZY_INIT	0x40		/* the shared library init routine is
+					   to be run lazily via catching memory
+					   faults to its writeable segments
+					   (obsolete) */
+#define MH_TWOLEVEL	0x80		/* the image is using two-level name
+					   space bindings */
+#define MH_FORCE_FLAT	0x100		/* the executable is forcing all images
+					   to use flat name space bindings */
+#define MH_NOMULTIDEFS	0x200		/* this umbrella guarantees no multiple
+					   defintions of symbols in its
+					   sub-images so the two-level namespace
+					   hints can always be used. */
+#define MH_NOFIXPREBINDING 0x400	/* do not have dyld notify the
+					   prebinding agent about this
+					   executable */
+#define MH_PREBINDABLE  0x800           /* the binary is not prebound but can
+					   have its prebinding redone. only used
+                                           when MH_PREBOUND is not set. */
+#define MH_ALLMODSBOUND 0x1000		/* indicates that this binary binds to
+                                           all two-level namespace modules of
+					   its dependent libraries. only used
+					   when MH_PREBINDABLE and MH_TWOLEVEL
+					   are both set. */ 
+#define MH_SUBSECTIONS_VIA_SYMBOLS 0x2000/* safe to divide up the sections into
+					    sub-sections via symbols for dead
+					    code stripping */
+#define MH_CANONICAL    0x4000		/* the binary has been canonicalized
+					   via the unprebind operation */
+#define MH_WEAK_DEFINES	0x8000		/* the final linked image contains
+					   external weak symbols */
+#define MH_BINDS_TO_WEAK 0x10000	/* the final linked image uses
+					   weak symbols */
+
+#define MH_ALLOW_STACK_EXECUTION 0x20000/* When this bit is set, all stacks 
+					   in the task will be given stack
+					   execution privilege.  Only used in
+					   MH_EXECUTE filetypes. */
+#define MH_ROOT_SAFE 0x40000           /* When this bit is set, the binary 
+					  declares it is safe for use in
+					  processes with uid zero */
+                                         
+#define MH_SETUID_SAFE 0x80000         /* When this bit is set, the binary 
+					  declares it is safe for use in
+					  processes when issetugid() is true */
+
+#define MH_NO_REEXPORTED_DYLIBS 0x100000 /* When this bit is set on a dylib, 
+					  the static linker does not need to
+					  examine dependent dylibs to see
+					  if any are re-exported */
+#define	MH_PIE 0x200000			/* When this bit is set, the OS will
+					   load the main executable at a
+					   random address.  Only used in
+					   MH_EXECUTE filetypes. */
+#define	MH_DEAD_STRIPPABLE_DYLIB 0x400000 /* Only for use on dylibs.  When
+					     linking against a dylib that
+					     has this bit set, the static linker
+					     will automatically not create a
+					     LC_LOAD_DYLIB load command to the
+					     dylib if no symbols are being
+					     referenced from the dylib. */
+#define MH_HAS_TLV_DESCRIPTORS 0x800000 /* Contains a section of type 
+					    S_THREAD_LOCAL_VARIABLES */
+
+#define MH_NO_HEAP_EXECUTION 0x1000000	/* When this bit is set, the OS will
+					   run the main executable with
+					   a non-executable heap even on
+					   platforms (e.g. i386) that don't
+					   require it. Only used in MH_EXECUTE
+					   filetypes. */
+
+/*
+ * The load commands directly follow the mach_header.  The total size of all
+ * of the commands is given by the sizeofcmds field in the mach_header.  All
+ * load commands must have as their first two fields cmd and cmdsize.  The cmd
+ * field is filled in with a constant for that command type.  Each command type
+ * has a structure specifically for it.  The cmdsize field is the size in bytes
+ * of the particular load command structure plus anything that follows it that
+ * is a part of the load command (i.e. section structures, strings, etc.).  To
+ * advance to the next load command the cmdsize can be added to the offset or
+ * pointer of the current load command.  The cmdsize for 32-bit architectures
+ * MUST be a multiple of 4 bytes and for 64-bit architectures MUST be a multiple
+ * of 8 bytes (these are forever the maximum alignment of any load commands).
+ * The padded bytes must be zero.  All tables in the object file must also
+ * follow these rules so the file can be memory mapped.  Otherwise the pointers
+ * to these tables will not work well or at all on some machines.  With all
+ * padding zeroed like objects will compare byte for byte.
+ */
+struct load_command {
+	uint32_t cmd;		/* type of load command */
+	uint32_t cmdsize;	/* total size of command in bytes */
+};
+
+/*
+ * After MacOS X 10.1 when a new load command is added that is required to be
+ * understood by the dynamic linker for the image to execute properly the
+ * LC_REQ_DYLD bit will be or'ed into the load command constant.  If the dynamic
+ * linker sees such a load command it it does not understand will issue a
+ * "unknown load command required for execution" error and refuse to use the
+ * image.  Other load commands without this bit that are not understood will
+ * simply be ignored.
+ */
+#define LC_REQ_DYLD 0x80000000
+
+/* Constants for the cmd field of all load commands, the type */
+#define	LC_SEGMENT	0x1	/* segment of this file to be mapped */
+#define	LC_SYMTAB	0x2	/* link-edit stab symbol table info */
+#define	LC_SYMSEG	0x3	/* link-edit gdb symbol table info (obsolete) */
+#define	LC_THREAD	0x4	/* thread */
+#define	LC_UNIXTHREAD	0x5	/* unix thread (includes a stack) */
+#define	LC_LOADFVMLIB	0x6	/* load a specified fixed VM shared library */
+#define	LC_IDFVMLIB	0x7	/* fixed VM shared library identification */
+#define	LC_IDENT	0x8	/* object identification info (obsolete) */
+#define LC_FVMFILE	0x9	/* fixed VM file inclusion (internal use) */
+#define LC_PREPAGE      0xa     /* prepage command (internal use) */
+#define	LC_DYSYMTAB	0xb	/* dynamic link-edit symbol table info */
+#define	LC_LOAD_DYLIB	0xc	/* load a dynamically linked shared library */
+#define	LC_ID_DYLIB	0xd	/* dynamically linked shared lib ident */
+#define LC_LOAD_DYLINKER 0xe	/* load a dynamic linker */
+#define LC_ID_DYLINKER	0xf	/* dynamic linker identification */
+#define	LC_PREBOUND_DYLIB 0x10	/* modules prebound for a dynamically */
+				/*  linked shared library */
+#define	LC_ROUTINES	0x11	/* image routines */
+#define	LC_SUB_FRAMEWORK 0x12	/* sub framework */
+#define	LC_SUB_UMBRELLA 0x13	/* sub umbrella */
+#define	LC_SUB_CLIENT	0x14	/* sub client */
+#define	LC_SUB_LIBRARY  0x15	/* sub library */
+#define	LC_TWOLEVEL_HINTS 0x16	/* two-level namespace lookup hints */
+#define	LC_PREBIND_CKSUM  0x17	/* prebind checksum */
+
+/*
+ * load a dynamically linked shared library that is allowed to be missing
+ * (all symbols are weak imported).
+ */
+#define	LC_LOAD_WEAK_DYLIB (0x18 | LC_REQ_DYLD)
+
+#define	LC_SEGMENT_64	0x19	/* 64-bit segment of this file to be
+				   mapped */
+#define	LC_ROUTINES_64	0x1a	/* 64-bit image routines */
+#define LC_UUID		0x1b	/* the uuid */
+#define LC_RPATH       (0x1c | LC_REQ_DYLD)    /* runpath additions */
+#define LC_CODE_SIGNATURE 0x1d	/* local of code signature */
+#define LC_SEGMENT_SPLIT_INFO 0x1e /* local of info to split segments */
+#define LC_REEXPORT_DYLIB (0x1f | LC_REQ_DYLD) /* load and re-export dylib */
+#define	LC_LAZY_LOAD_DYLIB 0x20	/* delay load of dylib until first use */
+#define	LC_ENCRYPTION_INFO 0x21	/* encrypted segment information */
+#define	LC_DYLD_INFO 	0x22	/* compressed dyld information */
+#define	LC_DYLD_INFO_ONLY (0x22|LC_REQ_DYLD)	/* compressed dyld information only */
+#define	LC_LOAD_UPWARD_DYLIB (0x23 | LC_REQ_DYLD) /* load upward dylib */
+#define LC_VERSION_MIN_MACOSX 0x24   /* build for MacOSX min OS version */
+#define LC_VERSION_MIN_IPHONEOS 0x25 /* build for iPhoneOS min OS version */
+#define LC_FUNCTION_STARTS 0x26 /* compressed table of function start addresses */
+#define LC_DYLD_ENVIRONMENT 0x27 /* string for dyld to treat
+				    like environment variable */
+
+/*
+ * A variable length string in a load command is represented by an lc_str
+ * union.  The strings are stored just after the load command structure and
+ * the offset is from the start of the load command structure.  The size
+ * of the string is reflected in the cmdsize field of the load command.
+ * Once again any padded bytes to bring the cmdsize field to a multiple
+ * of 4 bytes must be zero.
+ */
+union lc_str {
+	uint32_t	offset;	/* offset to the string */
+#ifndef __LP64__
+	char		*ptr;	/* pointer to the string */
+#endif 
+};
+
+/*
+ * The segment load command indicates that a part of this file is to be
+ * mapped into the task's address space.  The size of this segment in memory,
+ * vmsize, maybe equal to or larger than the amount to map from this file,
+ * filesize.  The file is mapped starting at fileoff to the beginning of
+ * the segment in memory, vmaddr.  The rest of the memory of the segment,
+ * if any, is allocated zero fill on demand.  The segment's maximum virtual
+ * memory protection and initial virtual memory protection are specified
+ * by the maxprot and initprot fields.  If the segment has sections then the
+ * section structures directly follow the segment command and their size is
+ * reflected in cmdsize.
+ */
+struct segment_command { /* for 32-bit architectures */
+	uint32_t	cmd;		/* LC_SEGMENT */
+	uint32_t	cmdsize;	/* includes sizeof section structs */
+	char		segname[16];	/* segment name */
+	uint32_t	vmaddr;		/* memory address of this segment */
+	uint32_t	vmsize;		/* memory size of this segment */
+	uint32_t	fileoff;	/* file offset of this segment */
+	uint32_t	filesize;	/* amount to map from the file */
+	vm_prot_t	maxprot;	/* maximum VM protection */
+	vm_prot_t	initprot;	/* initial VM protection */
+	uint32_t	nsects;		/* number of sections in segment */
+	uint32_t	flags;		/* flags */
+};
+
+/*
+ * The 64-bit segment load command indicates that a part of this file is to be
+ * mapped into a 64-bit task's address space.  If the 64-bit segment has
+ * sections then section_64 structures directly follow the 64-bit segment
+ * command and their size is reflected in cmdsize.
+ */
+struct segment_command_64 { /* for 64-bit architectures */
+	uint32_t	cmd;		/* LC_SEGMENT_64 */
+	uint32_t	cmdsize;	/* includes sizeof section_64 structs */
+	char		segname[16];	/* segment name */
+	uint64_t	vmaddr;		/* memory address of this segment */
+	uint64_t	vmsize;		/* memory size of this segment */
+	uint64_t	fileoff;	/* file offset of this segment */
+	uint64_t	filesize;	/* amount to map from the file */
+	vm_prot_t	maxprot;	/* maximum VM protection */
+	vm_prot_t	initprot;	/* initial VM protection */
+	uint32_t	nsects;		/* number of sections in segment */
+	uint32_t	flags;		/* flags */
+};
+
+/* Constants for the flags field of the segment_command */
+#define	SG_HIGHVM	0x1	/* the file contents for this segment is for
+				   the high part of the VM space, the low part
+				   is zero filled (for stacks in core files) */
+#define	SG_FVMLIB	0x2	/* this segment is the VM that is allocated by
+				   a fixed VM library, for overlap checking in
+				   the link editor */
+#define	SG_NORELOC	0x4	/* this segment has nothing that was relocated
+				   in it and nothing relocated to it, that is
+				   it maybe safely replaced without relocation*/
+#define SG_PROTECTED_VERSION_1	0x8 /* This segment is protected.  If the
+				       segment starts at file offset 0, the
+				       first page of the segment is not
+				       protected.  All other pages of the
+				       segment are protected. */
+
+/*
+ * A segment is made up of zero or more sections.  Non-MH_OBJECT files have
+ * all of their segments with the proper sections in each, and padded to the
+ * specified segment alignment when produced by the link editor.  The first
+ * segment of a MH_EXECUTE and MH_FVMLIB format file contains the mach_header
+ * and load commands of the object file before its first section.  The zero
+ * fill sections are always last in their segment (in all formats).  This
+ * allows the zeroed segment padding to be mapped into memory where zero fill
+ * sections might be. The gigabyte zero fill sections, those with the section
+ * type S_GB_ZEROFILL, can only be in a segment with sections of this type.
+ * These segments are then placed after all other segments.
+ *
+ * The MH_OBJECT format has all of its sections in one segment for
+ * compactness.  There is no padding to a specified segment boundary and the
+ * mach_header and load commands are not part of the segment.
+ *
+ * Sections with the same section name, sectname, going into the same segment,
+ * segname, are combined by the link editor.  The resulting section is aligned
+ * to the maximum alignment of the combined sections and is the new section's
+ * alignment.  The combined sections are aligned to their original alignment in
+ * the combined section.  Any padded bytes to get the specified alignment are
+ * zeroed.
+ *
+ * The format of the relocation entries referenced by the reloff and nreloc
+ * fields of the section structure for mach object files is described in the
+ * header file <reloc.h>.
+ */
+struct section { /* for 32-bit architectures */
+	char		sectname[16];	/* name of this section */
+	char		segname[16];	/* segment this section goes in */
+	uint32_t	addr;		/* memory address of this section */
+	uint32_t	size;		/* size in bytes of this section */
+	uint32_t	offset;		/* file offset of this section */
+	uint32_t	align;		/* section alignment (power of 2) */
+	uint32_t	reloff;		/* file offset of relocation entries */
+	uint32_t	nreloc;		/* number of relocation entries */
+	uint32_t	flags;		/* flags (section type and attributes)*/
+	uint32_t	reserved1;	/* reserved (for offset or index) */
+	uint32_t	reserved2;	/* reserved (for count or sizeof) */
+};
+
+struct section_64 { /* for 64-bit architectures */
+	char		sectname[16];	/* name of this section */
+	char		segname[16];	/* segment this section goes in */
+	uint64_t	addr;		/* memory address of this section */
+	uint64_t	size;		/* size in bytes of this section */
+	uint32_t	offset;		/* file offset of this section */
+	uint32_t	align;		/* section alignment (power of 2) */
+	uint32_t	reloff;		/* file offset of relocation entries */
+	uint32_t	nreloc;		/* number of relocation entries */
+	uint32_t	flags;		/* flags (section type and attributes)*/
+	uint32_t	reserved1;	/* reserved (for offset or index) */
+	uint32_t	reserved2;	/* reserved (for count or sizeof) */
+	uint32_t	reserved3;	/* reserved */
+};
+
+/*
+ * The flags field of a section structure is separated into two parts a section
+ * type and section attributes.  The section types are mutually exclusive (it
+ * can only have one type) but the section attributes are not (it may have more
+ * than one attribute).
+ */
+#define SECTION_TYPE		 0x000000ff	/* 256 section types */
+#define SECTION_ATTRIBUTES	 0xffffff00	/*  24 section attributes */
+
+/* Constants for the type of a section */
+#define	S_REGULAR		0x0	/* regular section */
+#define	S_ZEROFILL		0x1	/* zero fill on demand section */
+#define	S_CSTRING_LITERALS	0x2	/* section with only literal C strings*/
+#define	S_4BYTE_LITERALS	0x3	/* section with only 4 byte literals */
+#define	S_8BYTE_LITERALS	0x4	/* section with only 8 byte literals */
+#define	S_LITERAL_POINTERS	0x5	/* section with only pointers to */
+					/*  literals */
+/*
+ * For the two types of symbol pointers sections and the symbol stubs section
+ * they have indirect symbol table entries.  For each of the entries in the
+ * section the indirect symbol table entries, in corresponding order in the
+ * indirect symbol table, start at the index stored in the reserved1 field
+ * of the section structure.  Since the indirect symbol table entries
+ * correspond to the entries in the section the number of indirect symbol table
+ * entries is inferred from the size of the section divided by the size of the
+ * entries in the section.  For symbol pointers sections the size of the entries
+ * in the section is 4 bytes and for symbol stubs sections the byte size of the
+ * stubs is stored in the reserved2 field of the section structure.
+ */
+#define	S_NON_LAZY_SYMBOL_POINTERS	0x6	/* section with only non-lazy
+						   symbol pointers */
+#define	S_LAZY_SYMBOL_POINTERS		0x7	/* section with only lazy symbol
+						   pointers */
+#define	S_SYMBOL_STUBS			0x8	/* section with only symbol
+						   stubs, byte size of stub in
+						   the reserved2 field */
+#define	S_MOD_INIT_FUNC_POINTERS	0x9	/* section with only function
+						   pointers for initialization*/
+#define	S_MOD_TERM_FUNC_POINTERS	0xa	/* section with only function
+						   pointers for termination */
+#define	S_COALESCED			0xb	/* section contains symbols that
+						   are to be coalesced */
+#define	S_GB_ZEROFILL			0xc	/* zero fill on demand section
+						   (that can be larger than 4
+						   gigabytes) */
+#define	S_INTERPOSING			0xd	/* section with only pairs of
+						   function pointers for
+						   interposing */
+#define	S_16BYTE_LITERALS		0xe	/* section with only 16 byte
+						   literals */
+#define	S_DTRACE_DOF			0xf	/* section contains 
+						   DTrace Object Format */
+#define	S_LAZY_DYLIB_SYMBOL_POINTERS	0x10	/* section with only lazy
+						   symbol pointers to lazy
+						   loaded dylibs */
+/*
+ * Section types to support thread local variables
+ */
+#define S_THREAD_LOCAL_REGULAR                   0x11  /* template of initial 
+							  values for TLVs */
+#define S_THREAD_LOCAL_ZEROFILL                  0x12  /* template of initial 
+							  values for TLVs */
+#define S_THREAD_LOCAL_VARIABLES                 0x13  /* TLV descriptors */
+#define S_THREAD_LOCAL_VARIABLE_POINTERS         0x14  /* pointers to TLV 
+                                                          descriptors */
+#define S_THREAD_LOCAL_INIT_FUNCTION_POINTERS    0x15  /* functions to call
+							  to initialize TLV
+							  values */
+
+/*
+ * Constants for the section attributes part of the flags field of a section
+ * structure.
+ */
+#define SECTION_ATTRIBUTES_USR	 0xff000000	/* User setable attributes */
+#define S_ATTR_PURE_INSTRUCTIONS 0x80000000	/* section contains only true
+						   machine instructions */
+#define S_ATTR_NO_TOC 		 0x40000000	/* section contains coalesced
+						   symbols that are not to be
+						   in a ranlib table of
+						   contents */
+#define S_ATTR_STRIP_STATIC_SYMS 0x20000000	/* ok to strip static symbols
+						   in this section in files
+						   with the MH_DYLDLINK flag */
+#define S_ATTR_NO_DEAD_STRIP	 0x10000000	/* no dead stripping */
+#define S_ATTR_LIVE_SUPPORT	 0x08000000	/* blocks are live if they
+						   reference live blocks */
+#define S_ATTR_SELF_MODIFYING_CODE 0x04000000	/* Used with i386 code stubs
+						   written on by dyld */
+/*
+ * If a segment contains any sections marked with S_ATTR_DEBUG then all
+ * sections in that segment must have this attribute.  No section other than
+ * a section marked with this attribute may reference the contents of this
+ * section.  A section with this attribute may contain no symbols and must have
+ * a section type S_REGULAR.  The static linker will not copy section contents
+ * from sections with this attribute into its output file.  These sections
+ * generally contain DWARF debugging info.
+ */ 
+#define	S_ATTR_DEBUG		 0x02000000	/* a debug section */
+#define SECTION_ATTRIBUTES_SYS	 0x00ffff00	/* system setable attributes */
+#define S_ATTR_SOME_INSTRUCTIONS 0x00000400	/* section contains some
+						   machine instructions */
+#define S_ATTR_EXT_RELOC	 0x00000200	/* section has external
+						   relocation entries */
+#define S_ATTR_LOC_RELOC	 0x00000100	/* section has local
+						   relocation entries */
+
+
+/*
+ * The names of segments and sections in them are mostly meaningless to the
+ * link-editor.  But there are few things to support traditional UNIX
+ * executables that require the link-editor and assembler to use some names
+ * agreed upon by convention.
+ *
+ * The initial protection of the "__TEXT" segment has write protection turned
+ * off (not writeable).
+ *
+ * The link-editor will allocate common symbols at the end of the "__common"
+ * section in the "__DATA" segment.  It will create the section and segment
+ * if needed.
+ */
+
+/* The currently known segment names and the section names in those segments */
+
+#define	SEG_PAGEZERO	"__PAGEZERO"	/* the pagezero segment which has no */
+					/* protections and catches NULL */
+					/* references for MH_EXECUTE files */
+
+
+#define	SEG_TEXT	"__TEXT"	/* the tradition UNIX text segment */
+#define	SECT_TEXT	"__text"	/* the real text part of the text */
+					/* section no headers, and no padding */
+#define SECT_FVMLIB_INIT0 "__fvmlib_init0"	/* the fvmlib initialization */
+						/*  section */
+#define SECT_FVMLIB_INIT1 "__fvmlib_init1"	/* the section following the */
+					        /*  fvmlib initialization */
+						/*  section */
+
+#define	SEG_DATA	"__DATA"	/* the tradition UNIX data segment */
+#define	SECT_DATA	"__data"	/* the real initialized data section */
+					/* no padding, no bss overlap */
+#define	SECT_BSS	"__bss"		/* the real uninitialized data section*/
+					/* no padding */
+#define SECT_COMMON	"__common"	/* the section common symbols are */
+					/* allocated in by the link editor */
+
+#define	SEG_OBJC	"__OBJC"	/* objective-C runtime segment */
+#define SECT_OBJC_SYMBOLS "__symbol_table"	/* symbol table */
+#define SECT_OBJC_MODULES "__module_info"	/* module information */
+#define SECT_OBJC_STRINGS "__selector_strs"	/* string table */
+#define SECT_OBJC_REFS "__selector_refs"	/* string table */
+
+#define	SEG_ICON	 "__ICON"	/* the icon segment */
+#define	SECT_ICON_HEADER "__header"	/* the icon headers */
+#define	SECT_ICON_TIFF   "__tiff"	/* the icons in tiff format */
+
+#define	SEG_LINKEDIT	"__LINKEDIT"	/* the segment containing all structs */
+					/* created and maintained by the link */
+					/* editor.  Created with -seglinkedit */
+					/* option to ld(1) for MH_EXECUTE and */
+					/* FVMLIB file types only */
+
+#define SEG_UNIXSTACK	"__UNIXSTACK"	/* the unix stack segment */
+
+#define SEG_IMPORT	"__IMPORT"	/* the segment for the self (dyld) */
+					/* modifing code stubs that has read, */
+					/* write and execute permissions */
+
+/*
+ * Fixed virtual memory shared libraries are identified by two things.  The
+ * target pathname (the name of the library as found for execution), and the
+ * minor version number.  The address of where the headers are loaded is in
+ * header_addr. (THIS IS OBSOLETE and no longer supported).
+ */
+struct fvmlib {
+	union lc_str	name;		/* library's target pathname */
+	uint32_t	minor_version;	/* library's minor version number */
+	uint32_t	header_addr;	/* library's header address */
+};
+
+/*
+ * A fixed virtual shared library (filetype == MH_FVMLIB in the mach header)
+ * contains a fvmlib_command (cmd == LC_IDFVMLIB) to identify the library.
+ * An object that uses a fixed virtual shared library also contains a
+ * fvmlib_command (cmd == LC_LOADFVMLIB) for each library it uses.
+ * (THIS IS OBSOLETE and no longer supported).
+ */
+struct fvmlib_command {
+	uint32_t	cmd;		/* LC_IDFVMLIB or LC_LOADFVMLIB */
+	uint32_t	cmdsize;	/* includes pathname string */
+	struct fvmlib	fvmlib;		/* the library identification */
+};
+
+/*
+ * Dynamicly linked shared libraries are identified by two things.  The
+ * pathname (the name of the library as found for execution), and the
+ * compatibility version number.  The pathname must match and the compatibility
+ * number in the user of the library must be greater than or equal to the
+ * library being used.  The time stamp is used to record the time a library was
+ * built and copied into user so it can be use to determined if the library used
+ * at runtime is exactly the same as used to built the program.
+ */
+struct dylib {
+    union lc_str  name;			/* library's path name */
+    uint32_t timestamp;			/* library's build time stamp */
+    uint32_t current_version;		/* library's current version number */
+    uint32_t compatibility_version;	/* library's compatibility vers number*/
+};
+
+/*
+ * A dynamically linked shared library (filetype == MH_DYLIB in the mach header)
+ * contains a dylib_command (cmd == LC_ID_DYLIB) to identify the library.
+ * An object that uses a dynamically linked shared library also contains a
+ * dylib_command (cmd == LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, or
+ * LC_REEXPORT_DYLIB) for each library it uses.
+ */
+struct dylib_command {
+	uint32_t	cmd;		/* LC_ID_DYLIB, LC_LOAD_{,WEAK_}DYLIB,
+					   LC_REEXPORT_DYLIB */
+	uint32_t	cmdsize;	/* includes pathname string */
+	struct dylib	dylib;		/* the library identification */
+};
+
+/*
+ * A dynamically linked shared library may be a subframework of an umbrella
+ * framework.  If so it will be linked with "-umbrella umbrella_name" where
+ * Where "umbrella_name" is the name of the umbrella framework. A subframework
+ * can only be linked against by its umbrella framework or other subframeworks
+ * that are part of the same umbrella framework.  Otherwise the static link
+ * editor produces an error and states to link against the umbrella framework.
+ * The name of the umbrella framework for subframeworks is recorded in the
+ * following structure.
+ */
+struct sub_framework_command {
+	uint32_t	cmd;		/* LC_SUB_FRAMEWORK */
+	uint32_t	cmdsize;	/* includes umbrella string */
+	union lc_str 	umbrella;	/* the umbrella framework name */
+};
+
+/*
+ * For dynamically linked shared libraries that are subframework of an umbrella
+ * framework they can allow clients other than the umbrella framework or other
+ * subframeworks in the same umbrella framework.  To do this the subframework
+ * is built with "-allowable_client client_name" and an LC_SUB_CLIENT load
+ * command is created for each -allowable_client flag.  The client_name is
+ * usually a framework name.  It can also be a name used for bundles clients
+ * where the bundle is built with "-client_name client_name".
+ */
+struct sub_client_command {
+	uint32_t	cmd;		/* LC_SUB_CLIENT */
+	uint32_t	cmdsize;	/* includes client string */
+	union lc_str 	client;		/* the client name */
+};
+
+/*
+ * A dynamically linked shared library may be a sub_umbrella of an umbrella
+ * framework.  If so it will be linked with "-sub_umbrella umbrella_name" where
+ * Where "umbrella_name" is the name of the sub_umbrella framework.  When
+ * staticly linking when -twolevel_namespace is in effect a twolevel namespace 
+ * umbrella framework will only cause its subframeworks and those frameworks
+ * listed as sub_umbrella frameworks to be implicited linked in.  Any other
+ * dependent dynamic libraries will not be linked it when -twolevel_namespace
+ * is in effect.  The primary library recorded by the static linker when
+ * resolving a symbol in these libraries will be the umbrella framework.
+ * Zero or more sub_umbrella frameworks may be use by an umbrella framework.
+ * The name of a sub_umbrella framework is recorded in the following structure.
+ */
+struct sub_umbrella_command {
+	uint32_t	cmd;		/* LC_SUB_UMBRELLA */
+	uint32_t	cmdsize;	/* includes sub_umbrella string */
+	union lc_str 	sub_umbrella;	/* the sub_umbrella framework name */
+};
+
+/*
+ * A dynamically linked shared library may be a sub_library of another shared
+ * library.  If so it will be linked with "-sub_library library_name" where
+ * Where "library_name" is the name of the sub_library shared library.  When
+ * staticly linking when -twolevel_namespace is in effect a twolevel namespace 
+ * shared library will only cause its subframeworks and those frameworks
+ * listed as sub_umbrella frameworks and libraries listed as sub_libraries to
+ * be implicited linked in.  Any other dependent dynamic libraries will not be
+ * linked it when -twolevel_namespace is in effect.  The primary library
+ * recorded by the static linker when resolving a symbol in these libraries
+ * will be the umbrella framework (or dynamic library). Zero or more sub_library
+ * shared libraries may be use by an umbrella framework or (or dynamic library).
+ * The name of a sub_library framework is recorded in the following structure.
+ * For example /usr/lib/libobjc_profile.A.dylib would be recorded as "libobjc".
+ */
+struct sub_library_command {
+	uint32_t	cmd;		/* LC_SUB_LIBRARY */
+	uint32_t	cmdsize;	/* includes sub_library string */
+	union lc_str 	sub_library;	/* the sub_library name */
+};
+
+/*
+ * A program (filetype == MH_EXECUTE) that is
+ * prebound to its dynamic libraries has one of these for each library that
+ * the static linker used in prebinding.  It contains a bit vector for the
+ * modules in the library.  The bits indicate which modules are bound (1) and
+ * which are not (0) from the library.  The bit for module 0 is the low bit
+ * of the first byte.  So the bit for the Nth module is:
+ * (linked_modules[N/8] >> N%8) & 1
+ */
+struct prebound_dylib_command {
+	uint32_t	cmd;		/* LC_PREBOUND_DYLIB */
+	uint32_t	cmdsize;	/* includes strings */
+	union lc_str	name;		/* library's path name */
+	uint32_t	nmodules;	/* number of modules in library */
+	union lc_str	linked_modules;	/* bit vector of linked modules */
+};
+
+/*
+ * A program that uses a dynamic linker contains a dylinker_command to identify
+ * the name of the dynamic linker (LC_LOAD_DYLINKER).  And a dynamic linker
+ * contains a dylinker_command to identify the dynamic linker (LC_ID_DYLINKER).
+ * A file can have at most one of these.
+ * This struct is also used for the LC_DYLD_ENVIRONMENT load command and
+ * contains string for dyld to treat like environment variable.
+ */
+struct dylinker_command {
+	uint32_t	cmd;		/* LC_ID_DYLINKER, LC_LOAD_DYLINKER or
+					   LC_DYLD_ENVIRONMENT */
+	uint32_t	cmdsize;	/* includes pathname string */
+	union lc_str    name;		/* dynamic linker's path name */
+};
+
+/*
+ * Thread commands contain machine-specific data structures suitable for
+ * use in the thread state primitives.  The machine specific data structures
+ * follow the struct thread_command as follows.
+ * Each flavor of machine specific data structure is preceded by an unsigned
+ * long constant for the flavor of that data structure, an uint32_t
+ * that is the count of longs of the size of the state data structure and then
+ * the state data structure follows.  This triple may be repeated for many
+ * flavors.  The constants for the flavors, counts and state data structure
+ * definitions are expected to be in the header file <machine/thread_status.h>.
+ * These machine specific data structures sizes must be multiples of
+ * 4 bytes  The cmdsize reflects the total size of the thread_command
+ * and all of the sizes of the constants for the flavors, counts and state
+ * data structures.
+ *
+ * For executable objects that are unix processes there will be one
+ * thread_command (cmd == LC_UNIXTHREAD) created for it by the link-editor.
+ * This is the same as a LC_THREAD, except that a stack is automatically
+ * created (based on the shell's limit for the stack size).  Command arguments
+ * and environment variables are copied onto that stack.
+ */
+struct thread_command {
+	uint32_t	cmd;		/* LC_THREAD or  LC_UNIXTHREAD */
+	uint32_t	cmdsize;	/* total size of this command */
+	/* uint32_t flavor		   flavor of thread state */
+	/* uint32_t count		   count of longs in thread state */
+	/* struct XXX_thread_state state   thread state for this flavor */
+	/* ... */
+};
+
+/*
+ * The routines command contains the address of the dynamic shared library 
+ * initialization routine and an index into the module table for the module
+ * that defines the routine.  Before any modules are used from the library the
+ * dynamic linker fully binds the module that defines the initialization routine
+ * and then calls it.  This gets called before any module initialization
+ * routines (used for C++ static constructors) in the library.
+ */
+struct routines_command { /* for 32-bit architectures */
+	uint32_t	cmd;		/* LC_ROUTINES */
+	uint32_t	cmdsize;	/* total size of this command */
+	uint32_t	init_address;	/* address of initialization routine */
+	uint32_t	init_module;	/* index into the module table that */
+				        /*  the init routine is defined in */
+	uint32_t	reserved1;
+	uint32_t	reserved2;
+	uint32_t	reserved3;
+	uint32_t	reserved4;
+	uint32_t	reserved5;
+	uint32_t	reserved6;
+};
+
+/*
+ * The 64-bit routines command.  Same use as above.
+ */
+struct routines_command_64 { /* for 64-bit architectures */
+	uint32_t	cmd;		/* LC_ROUTINES_64 */
+	uint32_t	cmdsize;	/* total size of this command */
+	uint64_t	init_address;	/* address of initialization routine */
+	uint64_t	init_module;	/* index into the module table that */
+					/*  the init routine is defined in */
+	uint64_t	reserved1;
+	uint64_t	reserved2;
+	uint64_t	reserved3;
+	uint64_t	reserved4;
+	uint64_t	reserved5;
+	uint64_t	reserved6;
+};
+
+/*
+ * The symtab_command contains the offsets and sizes of the link-edit 4.3BSD
+ * "stab" style symbol table information as described in the header files
+ * <nlist.h> and <stab.h>.
+ */
+struct symtab_command {
+	uint32_t	cmd;		/* LC_SYMTAB */
+	uint32_t	cmdsize;	/* sizeof(struct symtab_command) */
+	uint32_t	symoff;		/* symbol table offset */
+	uint32_t	nsyms;		/* number of symbol table entries */
+	uint32_t	stroff;		/* string table offset */
+	uint32_t	strsize;	/* string table size in bytes */
+};
+
+/*
+ * This is the second set of the symbolic information which is used to support
+ * the data structures for the dynamically link editor.
+ *
+ * The original set of symbolic information in the symtab_command which contains
+ * the symbol and string tables must also be present when this load command is
+ * present.  When this load command is present the symbol table is organized
+ * into three groups of symbols:
+ *	local symbols (static and debugging symbols) - grouped by module
+ *	defined external symbols - grouped by module (sorted by name if not lib)
+ *	undefined external symbols (sorted by name if MH_BINDATLOAD is not set,
+ *	     			    and in order the were seen by the static
+ *				    linker if MH_BINDATLOAD is set)
+ * In this load command there are offsets and counts to each of the three groups
+ * of symbols.
+ *
+ * This load command contains a the offsets and sizes of the following new
+ * symbolic information tables:
+ *	table of contents
+ *	module table
+ *	reference symbol table
+ *	indirect symbol table
+ * The first three tables above (the table of contents, module table and
+ * reference symbol table) are only present if the file is a dynamically linked
+ * shared library.  For executable and object modules, which are files
+ * containing only one module, the information that would be in these three
+ * tables is determined as follows:
+ * 	table of contents - the defined external symbols are sorted by name
+ *	module table - the file contains only one module so everything in the
+ *		       file is part of the module.
+ *	reference symbol table - is the defined and undefined external symbols
+ *
+ * For dynamically linked shared library files this load command also contains
+ * offsets and sizes to the pool of relocation entries for all sections
+ * separated into two groups:
+ *	external relocation entries
+ *	local relocation entries
+ * For executable and object modules the relocation entries continue to hang
+ * off the section structures.
+ */
+struct dysymtab_command {
+    uint32_t cmd;	/* LC_DYSYMTAB */
+    uint32_t cmdsize;	/* sizeof(struct dysymtab_command) */
+
+    /*
+     * The symbols indicated by symoff and nsyms of the LC_SYMTAB load command
+     * are grouped into the following three groups:
+     *    local symbols (further grouped by the module they are from)
+     *    defined external symbols (further grouped by the module they are from)
+     *    undefined symbols
+     *
+     * The local symbols are used only for debugging.  The dynamic binding
+     * process may have to use them to indicate to the debugger the local
+     * symbols for a module that is being bound.
+     *
+     * The last two groups are used by the dynamic binding process to do the
+     * binding (indirectly through the module table and the reference symbol
+     * table when this is a dynamically linked shared library file).
+     */
+    uint32_t ilocalsym;	/* index to local symbols */
+    uint32_t nlocalsym;	/* number of local symbols */
+
+    uint32_t iextdefsym;/* index to externally defined symbols */
+    uint32_t nextdefsym;/* number of externally defined symbols */
+
+    uint32_t iundefsym;	/* index to undefined symbols */
+    uint32_t nundefsym;	/* number of undefined symbols */
+
+    /*
+     * For the for the dynamic binding process to find which module a symbol
+     * is defined in the table of contents is used (analogous to the ranlib
+     * structure in an archive) which maps defined external symbols to modules
+     * they are defined in.  This exists only in a dynamically linked shared
+     * library file.  For executable and object modules the defined external
+     * symbols are sorted by name and is use as the table of contents.
+     */
+    uint32_t tocoff;	/* file offset to table of contents */
+    uint32_t ntoc;	/* number of entries in table of contents */
+
+    /*
+     * To support dynamic binding of "modules" (whole object files) the symbol
+     * table must reflect the modules that the file was created from.  This is
+     * done by having a module table that has indexes and counts into the merged
+     * tables for each module.  The module structure that these two entries
+     * refer to is described below.  This exists only in a dynamically linked
+     * shared library file.  For executable and object modules the file only
+     * contains one module so everything in the file belongs to the module.
+     */
+    uint32_t modtaboff;	/* file offset to module table */
+    uint32_t nmodtab;	/* number of module table entries */
+
+    /*
+     * To support dynamic module binding the module structure for each module
+     * indicates the external references (defined and undefined) each module
+     * makes.  For each module there is an offset and a count into the
+     * reference symbol table for the symbols that the module references.
+     * This exists only in a dynamically linked shared library file.  For
+     * executable and object modules the defined external symbols and the
+     * undefined external symbols indicates the external references.
+     */
+    uint32_t extrefsymoff;	/* offset to referenced symbol table */
+    uint32_t nextrefsyms;	/* number of referenced symbol table entries */
+
+    /*
+     * The sections that contain "symbol pointers" and "routine stubs" have
+     * indexes and (implied counts based on the size of the section and fixed
+     * size of the entry) into the "indirect symbol" table for each pointer
+     * and stub.  For every section of these two types the index into the
+     * indirect symbol table is stored in the section header in the field
+     * reserved1.  An indirect symbol table entry is simply a 32bit index into
+     * the symbol table to the symbol that the pointer or stub is referring to.
+     * The indirect symbol table is ordered to match the entries in the section.
+     */
+    uint32_t indirectsymoff; /* file offset to the indirect symbol table */
+    uint32_t nindirectsyms;  /* number of indirect symbol table entries */
+
+    /*
+     * To support relocating an individual module in a library file quickly the
+     * external relocation entries for each module in the library need to be
+     * accessed efficiently.  Since the relocation entries can't be accessed
+     * through the section headers for a library file they are separated into
+     * groups of local and external entries further grouped by module.  In this
+     * case the presents of this load command who's extreloff, nextrel,
+     * locreloff and nlocrel fields are non-zero indicates that the relocation
+     * entries of non-merged sections are not referenced through the section
+     * structures (and the reloff and nreloc fields in the section headers are
+     * set to zero).
+     *
+     * Since the relocation entries are not accessed through the section headers
+     * this requires the r_address field to be something other than a section
+     * offset to identify the item to be relocated.  In this case r_address is
+     * set to the offset from the vmaddr of the first LC_SEGMENT command.
+     * For MH_SPLIT_SEGS images r_address is set to the the offset from the
+     * vmaddr of the first read-write LC_SEGMENT command.
+     *
+     * The relocation entries are grouped by module and the module table
+     * entries have indexes and counts into them for the group of external
+     * relocation entries for that the module.
+     *
+     * For sections that are merged across modules there must not be any
+     * remaining external relocation entries for them (for merged sections
+     * remaining relocation entries must be local).
+     */
+    uint32_t extreloff;	/* offset to external relocation entries */
+    uint32_t nextrel;	/* number of external relocation entries */
+
+    /*
+     * All the local relocation entries are grouped together (they are not
+     * grouped by their module since they are only used if the object is moved
+     * from it staticly link edited address).
+     */
+    uint32_t locreloff;	/* offset to local relocation entries */
+    uint32_t nlocrel;	/* number of local relocation entries */
+
+};	
+
+/*
+ * An indirect symbol table entry is simply a 32bit index into the symbol table 
+ * to the symbol that the pointer or stub is refering to.  Unless it is for a
+ * non-lazy symbol pointer section for a defined symbol which strip(1) as 
+ * removed.  In which case it has the value INDIRECT_SYMBOL_LOCAL.  If the
+ * symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that.
+ */
+#define INDIRECT_SYMBOL_LOCAL	0x80000000
+#define INDIRECT_SYMBOL_ABS	0x40000000
+
+
+/* a table of contents entry */
+struct dylib_table_of_contents {
+    uint32_t symbol_index;	/* the defined external symbol
+				   (index into the symbol table) */
+    uint32_t module_index;	/* index into the module table this symbol
+				   is defined in */
+};	
+
+/* a module table entry */
+struct dylib_module {
+    uint32_t module_name;	/* the module name (index into string table) */
+
+    uint32_t iextdefsym;	/* index into externally defined symbols */
+    uint32_t nextdefsym;	/* number of externally defined symbols */
+    uint32_t irefsym;		/* index into reference symbol table */
+    uint32_t nrefsym;		/* number of reference symbol table entries */
+    uint32_t ilocalsym;		/* index into symbols for local symbols */
+    uint32_t nlocalsym;		/* number of local symbols */
+
+    uint32_t iextrel;		/* index into external relocation entries */
+    uint32_t nextrel;		/* number of external relocation entries */
+
+    uint32_t iinit_iterm;	/* low 16 bits are the index into the init
+				   section, high 16 bits are the index into
+			           the term section */
+    uint32_t ninit_nterm;	/* low 16 bits are the number of init section
+				   entries, high 16 bits are the number of
+				   term section entries */
+
+    uint32_t			/* for this module address of the start of */
+	objc_module_info_addr;  /*  the (__OBJC,__module_info) section */
+    uint32_t			/* for this module size of */
+	objc_module_info_size;	/*  the (__OBJC,__module_info) section */
+};	
+
+/* a 64-bit module table entry */
+struct dylib_module_64 {
+    uint32_t module_name;	/* the module name (index into string table) */
+
+    uint32_t iextdefsym;	/* index into externally defined symbols */
+    uint32_t nextdefsym;	/* number of externally defined symbols */
+    uint32_t irefsym;		/* index into reference symbol table */
+    uint32_t nrefsym;		/* number of reference symbol table entries */
+    uint32_t ilocalsym;		/* index into symbols for local symbols */
+    uint32_t nlocalsym;		/* number of local symbols */
+
+    uint32_t iextrel;		/* index into external relocation entries */
+    uint32_t nextrel;		/* number of external relocation entries */
+
+    uint32_t iinit_iterm;	/* low 16 bits are the index into the init
+				   section, high 16 bits are the index into
+				   the term section */
+    uint32_t ninit_nterm;      /* low 16 bits are the number of init section
+				  entries, high 16 bits are the number of
+				  term section entries */
+
+    uint32_t			/* for this module size of */
+        objc_module_info_size;	/*  the (__OBJC,__module_info) section */
+    uint64_t			/* for this module address of the start of */
+        objc_module_info_addr;	/*  the (__OBJC,__module_info) section */
+};
+
+/* 
+ * The entries in the reference symbol table are used when loading the module
+ * (both by the static and dynamic link editors) and if the module is unloaded
+ * or replaced.  Therefore all external symbols (defined and undefined) are
+ * listed in the module's reference table.  The flags describe the type of
+ * reference that is being made.  The constants for the flags are defined in
+ * <mach-o/nlist.h> as they are also used for symbol table entries.
+ */
+struct dylib_reference {
+    uint32_t isym:24,		/* index into the symbol table */
+    		  flags:8;	/* flags to indicate the type of reference */
+};
+
+/*
+ * The twolevel_hints_command contains the offset and number of hints in the
+ * two-level namespace lookup hints table.
+ */
+struct twolevel_hints_command {
+    uint32_t cmd;	/* LC_TWOLEVEL_HINTS */
+    uint32_t cmdsize;	/* sizeof(struct twolevel_hints_command) */
+    uint32_t offset;	/* offset to the hint table */
+    uint32_t nhints;	/* number of hints in the hint table */
+};
+
+/*
+ * The entries in the two-level namespace lookup hints table are twolevel_hint
+ * structs.  These provide hints to the dynamic link editor where to start
+ * looking for an undefined symbol in a two-level namespace image.  The
+ * isub_image field is an index into the sub-images (sub-frameworks and
+ * sub-umbrellas list) that made up the two-level image that the undefined
+ * symbol was found in when it was built by the static link editor.  If
+ * isub-image is 0 the the symbol is expected to be defined in library and not
+ * in the sub-images.  If isub-image is non-zero it is an index into the array
+ * of sub-images for the umbrella with the first index in the sub-images being
+ * 1. The array of sub-images is the ordered list of sub-images of the umbrella
+ * that would be searched for a symbol that has the umbrella recorded as its
+ * primary library.  The table of contents index is an index into the
+ * library's table of contents.  This is used as the starting point of the
+ * binary search or a directed linear search.
+ */
+struct twolevel_hint {
+    uint32_t 
+	isub_image:8,	/* index into the sub images */
+	itoc:24;	/* index into the table of contents */
+};
+
+/*
+ * The prebind_cksum_command contains the value of the original check sum for
+ * prebound files or zero.  When a prebound file is first created or modified
+ * for other than updating its prebinding information the value of the check sum
+ * is set to zero.  When the file has it prebinding re-done and if the value of
+ * the check sum is zero the original check sum is calculated and stored in
+ * cksum field of this load command in the output file.  If when the prebinding
+ * is re-done and the cksum field is non-zero it is left unchanged from the
+ * input file.
+ */
+struct prebind_cksum_command {
+    uint32_t cmd;	/* LC_PREBIND_CKSUM */
+    uint32_t cmdsize;	/* sizeof(struct prebind_cksum_command) */
+    uint32_t cksum;	/* the check sum or zero */
+};
+
+/*
+ * The uuid load command contains a single 128-bit unique random number that
+ * identifies an object produced by the static link editor.
+ */
+struct uuid_command {
+    uint32_t	cmd;		/* LC_UUID */
+    uint32_t	cmdsize;	/* sizeof(struct uuid_command) */
+    uint8_t	uuid[16];	/* the 128-bit uuid */
+};
+
+/*
+ * The rpath_command contains a path which at runtime should be added to
+ * the current run path used to find @rpath prefixed dylibs.
+ */
+struct rpath_command {
+    uint32_t	 cmd;		/* LC_RPATH */
+    uint32_t	 cmdsize;	/* includes string */
+    union lc_str path;		/* path to add to run path */
+};
+
+/*
+ * The linkedit_data_command contains the offsets and sizes of a blob
+ * of data in the __LINKEDIT segment.  
+ */
+struct linkedit_data_command {
+    uint32_t	cmd;		/* LC_CODE_SIGNATURE, LC_SEGMENT_SPLIT_INFO,
+                                   or LC_FUNCTION_STARTS */
+    uint32_t	cmdsize;	/* sizeof(struct linkedit_data_command) */
+    uint32_t	dataoff;	/* file offset of data in __LINKEDIT segment */
+    uint32_t	datasize;	/* file size of data in __LINKEDIT segment  */
+};
+
+/*
+ * The encryption_info_command contains the file offset and size of an
+ * of an encrypted segment.
+ */
+struct encryption_info_command {
+   uint32_t	cmd;		/* LC_ENCRYPTION_INFO */
+   uint32_t	cmdsize;	/* sizeof(struct encryption_info_command) */
+   uint32_t	cryptoff;	/* file offset of encrypted range */
+   uint32_t	cryptsize;	/* file size of encrypted range */
+   uint32_t	cryptid;	/* which enryption system,
+				   0 means not-encrypted yet */
+};
+
+/*
+ * The version_min_command contains the min OS version on which this 
+ * binary was built to run.
+ */
+struct version_min_command {
+    uint32_t	cmd;		/* LC_VERSION_MIN_MACOSX or
+				   LC_VERSION_MIN_IPHONEOS  */
+    uint32_t	cmdsize;	/* sizeof(struct min_version_command) */
+    uint32_t	version;	/* X.Y.Z is encoded in nibbles xxxx.yy.zz */
+    uint32_t	reserved;	/* zero */
+};
+
+/*
+ * The dyld_info_command contains the file offsets and sizes of 
+ * the new compressed form of the information dyld needs to 
+ * load the image.  This information is used by dyld on Mac OS X
+ * 10.6 and later.  All information pointed to by this command
+ * is encoded using byte streams, so no endian swapping is needed
+ * to interpret it. 
+ */
+struct dyld_info_command {
+   uint32_t   cmd;		/* LC_DYLD_INFO or LC_DYLD_INFO_ONLY */
+   uint32_t   cmdsize;		/* sizeof(struct dyld_info_command) */
+
+    /*
+     * Dyld rebases an image whenever dyld loads it at an address different
+     * from its preferred address.  The rebase information is a stream
+     * of byte sized opcodes whose symbolic names start with REBASE_OPCODE_.
+     * Conceptually the rebase information is a table of tuples:
+     *    <seg-index, seg-offset, type>
+     * The opcodes are a compressed way to encode the table by only
+     * encoding when a column changes.  In addition simple patterns
+     * like "every n'th offset for m times" can be encoded in a few
+     * bytes.
+     */
+    uint32_t   rebase_off;	/* file offset to rebase info  */
+    uint32_t   rebase_size;	/* size of rebase info   */
+    
+    /*
+     * Dyld binds an image during the loading process, if the image
+     * requires any pointers to be initialized to symbols in other images.  
+     * The bind information is a stream of byte sized 
+     * opcodes whose symbolic names start with BIND_OPCODE_.
+     * Conceptually the bind information is a table of tuples:
+     *    <seg-index, seg-offset, type, symbol-library-ordinal, symbol-name, addend>
+     * The opcodes are a compressed way to encode the table by only
+     * encoding when a column changes.  In addition simple patterns
+     * like for runs of pointers initialzed to the same value can be 
+     * encoded in a few bytes.
+     */
+    uint32_t   bind_off;	/* file offset to binding info   */
+    uint32_t   bind_size;	/* size of binding info  */
+        
+    /*
+     * Some C++ programs require dyld to unique symbols so that all
+     * images in the process use the same copy of some code/data.
+     * This step is done after binding. The content of the weak_bind
+     * info is an opcode stream like the bind_info.  But it is sorted
+     * alphabetically by symbol name.  This enable dyld to walk 
+     * all images with weak binding information in order and look
+     * for collisions.  If there are no collisions, dyld does
+     * no updating.  That means that some fixups are also encoded
+     * in the bind_info.  For instance, all calls to "operator new"
+     * are first bound to libstdc++.dylib using the information
+     * in bind_info.  Then if some image overrides operator new
+     * that is detected when the weak_bind information is processed
+     * and the call to operator new is then rebound.
+     */
+    uint32_t   weak_bind_off;	/* file offset to weak binding info   */
+    uint32_t   weak_bind_size;  /* size of weak binding info  */
+    
+    /*
+     * Some uses of external symbols do not need to be bound immediately.
+     * Instead they can be lazily bound on first use.  The lazy_bind
+     * are contains a stream of BIND opcodes to bind all lazy symbols.
+     * Normal use is that dyld ignores the lazy_bind section when
+     * loading an image.  Instead the static linker arranged for the
+     * lazy pointer to initially point to a helper function which 
+     * pushes the offset into the lazy_bind area for the symbol
+     * needing to be bound, then jumps to dyld which simply adds
+     * the offset to lazy_bind_off to get the information on what 
+     * to bind.  
+     */
+    uint32_t   lazy_bind_off;	/* file offset to lazy binding info */
+    uint32_t   lazy_bind_size;  /* size of lazy binding infs */
+    
+    /*
+     * The symbols exported by a dylib are encoded in a trie.  This
+     * is a compact representation that factors out common prefixes.
+     * It also reduces LINKEDIT pages in RAM because it encodes all  
+     * information (name, address, flags) in one small, contiguous range.
+     * The export area is a stream of nodes.  The first node sequentially
+     * is the start node for the trie.  
+     *
+     * Nodes for a symbol start with a uleb128 that is the length of
+     * the exported symbol information for the string so far.
+     * If there is no exported symbol, the node starts with a zero byte. 
+     * If there is exported info, it follows the length.  First is
+     * a uleb128 containing flags.  Normally, it is followed by a
+     * uleb128 encoded offset which is location of the content named
+     * by the symbol from the mach_header for the image.  If the flags
+     * is EXPORT_SYMBOL_FLAGS_REEXPORT, then following the flags is
+     * a uleb128 encoded library ordinal, then a zero terminated
+     * UTF8 string.  If the string is zero length, then the symbol
+     * is re-export from the specified dylib with the same name.
+     *
+     * After the optional exported symbol information is a byte of
+     * how many edges (0-255) that this node has leaving it, 
+     * followed by each edge.
+     * Each edge is a zero terminated UTF8 of the addition chars
+     * in the symbol, followed by a uleb128 offset for the node that
+     * edge points to.
+     *  
+     */
+    uint32_t   export_off;	/* file offset to lazy binding info */
+    uint32_t   export_size;	/* size of lazy binding infs */
+};
+
+/*
+ * The following are used to encode rebasing information
+ */
+#define REBASE_TYPE_POINTER					1
+#define REBASE_TYPE_TEXT_ABSOLUTE32				2
+#define REBASE_TYPE_TEXT_PCREL32				3
+
+#define REBASE_OPCODE_MASK					0xF0
+#define REBASE_IMMEDIATE_MASK					0x0F
+#define REBASE_OPCODE_DONE					0x00
+#define REBASE_OPCODE_SET_TYPE_IMM				0x10
+#define REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB		0x20
+#define REBASE_OPCODE_ADD_ADDR_ULEB				0x30
+#define REBASE_OPCODE_ADD_ADDR_IMM_SCALED			0x40
+#define REBASE_OPCODE_DO_REBASE_IMM_TIMES			0x50
+#define REBASE_OPCODE_DO_REBASE_ULEB_TIMES			0x60
+#define REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB			0x70
+#define REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB	0x80
+
+
+/*
+ * The following are used to encode binding information
+ */
+#define BIND_TYPE_POINTER					1
+#define BIND_TYPE_TEXT_ABSOLUTE32				2
+#define BIND_TYPE_TEXT_PCREL32					3
+
+#define BIND_SPECIAL_DYLIB_SELF					 0
+#define BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE			-1
+#define BIND_SPECIAL_DYLIB_FLAT_LOOKUP				-2
+
+#define BIND_SYMBOL_FLAGS_WEAK_IMPORT				0x1
+#define BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION			0x8
+
+#define BIND_OPCODE_MASK					0xF0
+#define BIND_IMMEDIATE_MASK					0x0F
+#define BIND_OPCODE_DONE					0x00
+#define BIND_OPCODE_SET_DYLIB_ORDINAL_IMM			0x10
+#define BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB			0x20
+#define BIND_OPCODE_SET_DYLIB_SPECIAL_IMM			0x30
+#define BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM		0x40
+#define BIND_OPCODE_SET_TYPE_IMM				0x50
+#define BIND_OPCODE_SET_ADDEND_SLEB				0x60
+#define BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB			0x70
+#define BIND_OPCODE_ADD_ADDR_ULEB				0x80
+#define BIND_OPCODE_DO_BIND					0x90
+#define BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB			0xA0
+#define BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED			0xB0
+#define BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB		0xC0
+
+
+/*
+ * The following are used on the flags byte of a terminal node
+ * in the export information.
+ */
+#define EXPORT_SYMBOL_FLAGS_KIND_MASK				0x03
+#define EXPORT_SYMBOL_FLAGS_KIND_REGULAR			0x00
+#define EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL			0x01
+#define EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION			0x04
+#define EXPORT_SYMBOL_FLAGS_REEXPORT				0x08
+#define EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER			0x10
+
+/*
+ * The symseg_command contains the offset and size of the GNU style
+ * symbol table information as described in the header file <symseg.h>.
+ * The symbol roots of the symbol segments must also be aligned properly
+ * in the file.  So the requirement of keeping the offsets aligned to a
+ * multiple of a 4 bytes translates to the length field of the symbol
+ * roots also being a multiple of a long.  Also the padding must again be
+ * zeroed. (THIS IS OBSOLETE and no longer supported).
+ */
+struct symseg_command {
+	uint32_t	cmd;		/* LC_SYMSEG */
+	uint32_t	cmdsize;	/* sizeof(struct symseg_command) */
+	uint32_t	offset;		/* symbol segment offset */
+	uint32_t	size;		/* symbol segment size in bytes */
+};
+
+/*
+ * The ident_command contains a free format string table following the
+ * ident_command structure.  The strings are null terminated and the size of
+ * the command is padded out with zero bytes to a multiple of 4 bytes/
+ * (THIS IS OBSOLETE and no longer supported).
+ */
+struct ident_command {
+	uint32_t cmd;		/* LC_IDENT */
+	uint32_t cmdsize;	/* strings that follow this command */
+};
+
+/*
+ * The fvmfile_command contains a reference to a file to be loaded at the
+ * specified virtual address.  (Presently, this command is reserved for
+ * internal use.  The kernel ignores this command when loading a program into
+ * memory).
+ */
+struct fvmfile_command {
+	uint32_t cmd;			/* LC_FVMFILE */
+	uint32_t cmdsize;		/* includes pathname string */
+	union lc_str	name;		/* files pathname */
+	uint32_t	header_addr;	/* files virtual address */
+};
+
+/*
+ * Sections of type S_THREAD_LOCAL_VARIABLES contain an array 
+ * of tlv_descriptor structures.
+ */
+struct tlv_descriptor
+{
+	void*		(*thunk)(struct tlv_descriptor*);
+	unsigned long	key;
+	unsigned long	offset;
+};
+
+#endif /* _MACHO_LOADER_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach-o/nlist.h
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
+ * 
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+#ifndef _MACHO_NLIST_H_
+#define _MACHO_NLIST_H_
+/*	$NetBSD: nlist.h,v 1.5 1994/10/26 00:56:11 cgd Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
+ *
+ *	@(#)nlist.h	8.2 (Berkeley) 1/21/94
+ */
+#include <stdint.h>
+
+/*
+ * Format of a symbol table entry of a Mach-O file for 32-bit architectures.
+ * Modified from the BSD format.  The modifications from the original format
+ * were changing n_other (an unused field) to n_sect and the addition of the
+ * N_SECT type.  These modifications are required to support symbols in a larger
+ * number of sections not just the three sections (text, data and bss) in a BSD
+ * file.
+ */
+struct nlist {
+	union {
+#ifndef __LP64__
+		char *n_name;	/* for use when in-core */
+#endif
+		int32_t n_strx;	/* index into the string table */
+	} n_un;
+	uint8_t n_type;		/* type flag, see below */
+	uint8_t n_sect;		/* section number or NO_SECT */
+	int16_t n_desc;		/* see <mach-o/stab.h> */
+	uint32_t n_value;	/* value of this symbol (or stab offset) */
+};
+
+/*
+ * This is the symbol table entry structure for 64-bit architectures.
+ */
+struct nlist_64 {
+    union {
+        uint32_t  n_strx; /* index into the string table */
+    } n_un;
+    uint8_t n_type;        /* type flag, see below */
+    uint8_t n_sect;        /* section number or NO_SECT */
+    uint16_t n_desc;       /* see <mach-o/stab.h> */
+    uint64_t n_value;      /* value of this symbol (or stab offset) */
+};
+
+/*
+ * Symbols with a index into the string table of zero (n_un.n_strx == 0) are
+ * defined to have a null, "", name.  Therefore all string indexes to non null
+ * names must not have a zero string index.  This is bit historical information
+ * that has never been well documented.
+ */
+
+/*
+ * The n_type field really contains four fields:
+ *	unsigned char N_STAB:3,
+ *		      N_PEXT:1,
+ *		      N_TYPE:3,
+ *		      N_EXT:1;
+ * which are used via the following masks.
+ */
+#define	N_STAB	0xe0  /* if any of these bits set, a symbolic debugging entry */
+#define	N_PEXT	0x10  /* private external symbol bit */
+#define	N_TYPE	0x0e  /* mask for the type bits */
+#define	N_EXT	0x01  /* external symbol bit, set for external symbols */
+
+/*
+ * Only symbolic debugging entries have some of the N_STAB bits set and if any
+ * of these bits are set then it is a symbolic debugging entry (a stab).  In
+ * which case then the values of the n_type field (the entire field) are given
+ * in <mach-o/stab.h>
+ */
+
+/*
+ * Values for N_TYPE bits of the n_type field.
+ */
+#define	N_UNDF	0x0		/* undefined, n_sect == NO_SECT */
+#define	N_ABS	0x2		/* absolute, n_sect == NO_SECT */
+#define	N_SECT	0xe		/* defined in section number n_sect */
+#define	N_PBUD	0xc		/* prebound undefined (defined in a dylib) */
+#define N_INDR	0xa		/* indirect */
+
+/* 
+ * If the type is N_INDR then the symbol is defined to be the same as another
+ * symbol.  In this case the n_value field is an index into the string table
+ * of the other symbol's name.  When the other symbol is defined then they both
+ * take on the defined type and value.
+ */
+
+/*
+ * If the type is N_SECT then the n_sect field contains an ordinal of the
+ * section the symbol is defined in.  The sections are numbered from 1 and 
+ * refer to sections in order they appear in the load commands for the file
+ * they are in.  This means the same ordinal may very well refer to different
+ * sections in different files.
+ *
+ * The n_value field for all symbol table entries (including N_STAB's) gets
+ * updated by the link editor based on the value of it's n_sect field and where
+ * the section n_sect references gets relocated.  If the value of the n_sect 
+ * field is NO_SECT then it's n_value field is not changed by the link editor.
+ */
+#define	NO_SECT		0	/* symbol is not in any section */
+#define MAX_SECT	255	/* 1 thru 255 inclusive */
+
+/*
+ * Common symbols are represented by undefined (N_UNDF) external (N_EXT) types
+ * who's values (n_value) are non-zero.  In which case the value of the n_value
+ * field is the size (in bytes) of the common symbol.  The n_sect field is set
+ * to NO_SECT.  The alignment of a common symbol may be set as a power of 2
+ * between 2^1 and 2^15 as part of the n_desc field using the macros below. If
+ * the alignment is not set (a value of zero) then natural alignment based on
+ * the size is used.
+ */
+#define GET_COMM_ALIGN(n_desc) (((n_desc) >> 8) & 0x0f)
+#define SET_COMM_ALIGN(n_desc,align) \
+    (n_desc) = (((n_desc) & 0xf0ff) | (((align) & 0x0f) << 8))
+
+/*
+ * To support the lazy binding of undefined symbols in the dynamic link-editor,
+ * the undefined symbols in the symbol table (the nlist structures) are marked
+ * with the indication if the undefined reference is a lazy reference or
+ * non-lazy reference.  If both a non-lazy reference and a lazy reference is
+ * made to the same symbol the non-lazy reference takes precedence.  A reference
+ * is lazy only when all references to that symbol are made through a symbol
+ * pointer in a lazy symbol pointer section.
+ *
+ * The implementation of marking nlist structures in the symbol table for
+ * undefined symbols will be to use some of the bits of the n_desc field as a
+ * reference type.  The mask REFERENCE_TYPE will be applied to the n_desc field
+ * of an nlist structure for an undefined symbol to determine the type of
+ * undefined reference (lazy or non-lazy).
+ *
+ * The constants for the REFERENCE FLAGS are propagated to the reference table
+ * in a shared library file.  In that case the constant for a defined symbol,
+ * REFERENCE_FLAG_DEFINED, is also used.
+ */
+/* Reference type bits of the n_desc field of undefined symbols */
+#define REFERENCE_TYPE				0x7
+/* types of references */
+#define REFERENCE_FLAG_UNDEFINED_NON_LAZY		0
+#define REFERENCE_FLAG_UNDEFINED_LAZY			1
+#define REFERENCE_FLAG_DEFINED				2
+#define REFERENCE_FLAG_PRIVATE_DEFINED			3
+#define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY	4
+#define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY		5
+
+/*
+ * To simplify stripping of objects that use are used with the dynamic link
+ * editor, the static link editor marks the symbols defined an object that are
+ * referenced by a dynamicly bound object (dynamic shared libraries, bundles).
+ * With this marking strip knows not to strip these symbols.
+ */
+#define REFERENCED_DYNAMICALLY	0x0010
+
+/*
+ * For images created by the static link editor with the -twolevel_namespace
+ * option in effect the flags field of the mach header is marked with
+ * MH_TWOLEVEL.  And the binding of the undefined references of the image are
+ * determined by the static link editor.  Which library an undefined symbol is
+ * bound to is recorded by the static linker in the high 8 bits of the n_desc
+ * field using the SET_LIBRARY_ORDINAL macro below.  The ordinal recorded
+ * references the libraries listed in the Mach-O's LC_LOAD_DYLIB,
+ * LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and
+ * LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the
+ * headers.   The library ordinals start from 1.
+ * For a dynamic library that is built as a two-level namespace image the
+ * undefined references from module defined in another use the same nlist struct
+ * an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal.  For
+ * defined symbols in all images they also must have the library ordinal set to
+ * SELF_LIBRARY_ORDINAL.  The EXECUTABLE_ORDINAL refers to the executable
+ * image for references from plugins that refer to the executable that loads
+ * them.
+ * 
+ * The DYNAMIC_LOOKUP_ORDINAL is for undefined symbols in a two-level namespace
+ * image that are looked up by the dynamic linker with flat namespace semantics.
+ * This ordinal was added as a feature in Mac OS X 10.3 by reducing the
+ * value of MAX_LIBRARY_ORDINAL by one.  So it is legal for existing binaries
+ * or binaries built with older tools to have 0xfe (254) dynamic libraries.  In
+ * this case the ordinal value 0xfe (254) must be treated as a library ordinal
+ * for compatibility. 
+ */
+#define GET_LIBRARY_ORDINAL(n_desc) (((n_desc) >> 8) & 0xff)
+#define SET_LIBRARY_ORDINAL(n_desc,ordinal) \
+	(n_desc) = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8))
+#define SELF_LIBRARY_ORDINAL 0x0
+#define MAX_LIBRARY_ORDINAL 0xfd
+#define DYNAMIC_LOOKUP_ORDINAL 0xfe
+#define EXECUTABLE_ORDINAL 0xff
+
+/*
+ * The bit 0x0020 of the n_desc field is used for two non-overlapping purposes
+ * and has two different symbolic names, N_NO_DEAD_STRIP and N_DESC_DISCARDED.
+ */
+
+/*
+ * The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a 
+ * relocatable .o file (MH_OBJECT filetype). And is used to indicate to the
+ * static link editor it is never to dead strip the symbol.
+ */
+#define N_NO_DEAD_STRIP 0x0020 /* symbol is not to be dead stripped */
+
+/*
+ * The N_DESC_DISCARDED bit of the n_desc field never appears in linked image.
+ * But is used in very rare cases by the dynamic link editor to mark an in
+ * memory symbol as discared and longer used for linking.
+ */
+#define N_DESC_DISCARDED 0x0020	/* symbol is discarded */
+
+/*
+ * The N_WEAK_REF bit of the n_desc field indicates to the dynamic linker that
+ * the undefined symbol is allowed to be missing and is to have the address of
+ * zero when missing.
+ */
+#define N_WEAK_REF	0x0040 /* symbol is weak referenced */
+
+/*
+ * The N_WEAK_DEF bit of the n_desc field indicates to the static and dynamic
+ * linkers that the symbol definition is weak, allowing a non-weak symbol to
+ * also be used which causes the weak definition to be discared.  Currently this
+ * is only supported for symbols in coalesed sections.
+ */
+#define N_WEAK_DEF	0x0080 /* coalesed symbol is a weak definition */
+
+/*
+ * The N_REF_TO_WEAK bit of the n_desc field indicates to the dynamic linker
+ * that the undefined symbol should be resolved using flat namespace searching.
+ */
+#define	N_REF_TO_WEAK	0x0080 /* reference to a weak symbol */
+
+/*
+ * The N_ARM_THUMB_DEF bit of the n_desc field indicates that the symbol is
+ * a defintion of a Thumb function.
+ */
+#define N_ARM_THUMB_DEF	0x0008 /* symbol is a Thumb function (ARM) */
+
+/*
+ * The N_SYMBOL_RESOLVER bit of the n_desc field indicates that the
+ * that the function is actually a resolver function and should
+ * be called to get the address of the real function to use.
+ * This bit is only available in .o files (MH_OBJECT filetype)
+ */
+#define N_SYMBOL_RESOLVER  0x0100 
+
+#ifndef __STRICT_BSD__
+#if __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+/*
+ * The function nlist(3) from the C library.
+ */
+extern int nlist (const char *filename, struct nlist *list);
+#if __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __STRICT_BSD__ */
+
+#endif /* _MACHO_LIST_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/boolean.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/boolean.h
+ *
+ *	Boolean data type.
+ *
+ */
+
+#ifndef	_MACH_BOOLEAN_H_
+#define	_MACH_BOOLEAN_H_
+
+/*
+ *	Pick up "boolean_t" type definition
+ */
+
+#ifndef	ASSEMBLER
+#include <mach/machine/boolean.h>
+#endif	/* ASSEMBLER */
+
+/*
+ *	Define TRUE and FALSE if not defined.
+ */
+
+#ifndef	TRUE
+#define TRUE	1
+#endif	/* TRUE */
+
+#ifndef	FALSE
+#define FALSE	0
+#endif	/* FALSE */
+
+#endif	/* _MACH_BOOLEAN_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/i386/boolean.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	File:	boolean.h
+ *
+ *	Boolean type, for I386.
+ */
+
+#ifndef	_MACH_I386_BOOLEAN_H_
+#define _MACH_I386_BOOLEAN_H_
+
+#if defined(__x86_64__) && !defined(KERNEL)
+typedef unsigned int	boolean_t;
+#else
+typedef int		boolean_t;
+#endif
+
+#endif	/* _MACH_I386_BOOLEAN_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/i386/vm_param.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+/* 
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ */
+
+/*
+ *	File:	vm_param.h
+ *	Author:	Avadis Tevanian, Jr.
+ *	Date:	1985
+ *
+ *	I386 machine dependent virtual memory parameters.
+ *	Most of the declarations are preceeded by I386_ (or i386_)
+ *	which is OK because only I386 specific code will be using
+ *	them.
+ */
+
+#ifndef	_MACH_I386_VM_PARAM_H_
+#define _MACH_I386_VM_PARAM_H_
+
+#define BYTE_SIZE		8		/* byte size in bits */
+
+#define I386_PGBYTES		4096		/* bytes per 80386 page */
+#define I386_PGSHIFT		12		/* bitshift for pages */
+
+#define	PAGE_SIZE		I386_PGBYTES
+#define	PAGE_SHIFT		I386_PGSHIFT
+#define	PAGE_MASK		(PAGE_SIZE - 1)
+
+#define I386_LPGBYTES		2*1024*1024	/* bytes per large page */
+#define I386_LPGSHIFT		21		/* bitshift for large pages */
+#define I386_LPGMASK		(I386_LPGBYTES-1)
+
+/*
+ *	Convert bytes to pages and convert pages to bytes.
+ *	No rounding is used.
+ */
+
+#define i386_btop(x)		((ppnum_t)((x) >> I386_PGSHIFT))
+#define machine_btop(x)		i386_btop(x)
+#define i386_ptob(x)		(((pmap_paddr_t)(x)) << I386_PGSHIFT)
+
+/*
+ *	Round off or truncate to the nearest page.  These will work
+ *	for either addresses or counts.  (i.e. 1 byte rounds to 1 page
+ *	bytes.
+ */
+
+#define i386_round_page(x)	((((pmap_paddr_t)(x)) + I386_PGBYTES - 1) & \
+					~(I386_PGBYTES-1))
+#define i386_trunc_page(x)	(((pmap_paddr_t)(x)) & ~(I386_PGBYTES-1))
+
+
+
+#define VM_MIN_ADDRESS64	((user_addr_t) 0x0000000000000000ULL)
+/*
+ * default top of user stack... it grows down from here
+ */
+#define VM_USRSTACK64		((user_addr_t) 0x00007FFF5FC00000ULL)
+#define VM_DYLD64		((user_addr_t) 0x00007FFF5FC00000ULL)
+#define VM_LIB64_SHR_DATA	((user_addr_t) 0x00007FFF60000000ULL)
+#define VM_LIB64_SHR_TEXT	((user_addr_t) 0x00007FFF80000000ULL)
+/*
+ * the end of the usable user address space , for now about 47 bits.
+ * the 64 bit commpage is past the end of this
+ */
+#define VM_MAX_PAGE_ADDRESS	((user_addr_t) 0x00007FFFFFE00000ULL)
+/*
+ * canonical end of user address space for limits checking
+ */
+#define VM_MAX_USER_PAGE_ADDRESS ((user_addr_t)0x00007FFFFFFFF000ULL)
+
+
+/* system-wide values */
+#define MACH_VM_MIN_ADDRESS		((mach_vm_offset_t) 0)
+#define MACH_VM_MAX_ADDRESS		((mach_vm_offset_t) VM_MAX_PAGE_ADDRESS)
+
+/* process-relative values (all 32-bit legacy only for now) */
+#define VM_MIN_ADDRESS		((vm_offset_t) 0)
+#define VM_USRSTACK32		((vm_offset_t) 0xC0000000)
+#define VM_MAX_ADDRESS		((vm_offset_t) 0xFFE00000)
+
+
+
+#endif	/* _MACH_I386_VM_PARAM_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/i386/vm_types.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	File:	vm_types.h
+ *	Author:	Avadis Tevanian, Jr.
+ *	Date: 1985
+ *
+ *	Header file for VM data types.  I386 version.
+ */
+
+#ifndef	_MACH_I386_VM_TYPES_H_
+#define _MACH_I386_VM_TYPES_H_
+
+#ifndef	ASSEMBLER
+
+#include <i386/_types.h>
+#include <mach/i386/vm_param.h>
+#include <stdint.h>
+
+/*
+ * natural_t and integer_t are Mach's legacy types for machine-
+ * independent integer types (unsigned, and signed, respectively).
+ * Their original purpose was to define other types in a machine/
+ * compiler independent way.
+ *
+ * They also had an implicit "same size as pointer" characteristic
+ * to them (i.e. Mach's traditional types are very ILP32 or ILP64
+ * centric).  We support x86 ABIs that do not follow either of
+ * these models (specifically LP64).  Therefore, we had to make a
+ * choice between making these types scale with pointers or stay
+ * tied to integers.  Because their use is predominantly tied to
+ * to the size of an integer, we are keeping that association and
+ * breaking free from pointer size guarantees.
+ *
+ * New use of these types is discouraged.
+ */
+typedef __darwin_natural_t	natural_t;
+typedef int			integer_t;
+
+/*
+ * A vm_offset_t is a type-neutral pointer,
+ * e.g. an offset into a virtual memory space.
+ */
+#ifdef __LP64__
+typedef uintptr_t		vm_offset_t;
+#else	/* __LP64__ */
+typedef	natural_t		vm_offset_t;
+#endif	/* __LP64__ */
+
+/*
+ * A vm_size_t is the proper type for e.g.
+ * expressing the difference between two
+ * vm_offset_t entities.
+ */
+#ifdef __LP64__
+typedef uintptr_t		vm_size_t;
+#else	/* __LP64__ */
+typedef	natural_t		vm_size_t;
+#endif	/* __LP64__ */
+
+/*
+ * This new type is independent of a particular vm map's
+ * implementation size - and represents appropriate types
+ * for all possible maps.  This is used for interfaces
+ * where the size of the map is not known - or we don't
+ * want to have to distinguish.
+ */
+typedef uint64_t		mach_vm_address_t;
+typedef uint64_t		mach_vm_offset_t;
+typedef uint64_t		mach_vm_size_t;
+
+typedef uint64_t		vm_map_offset_t;
+typedef uint64_t		vm_map_address_t;
+typedef uint64_t		vm_map_size_t;
+
+
+#endif	/* ASSEMBLER */
+
+/*
+ * If composing messages by hand (please do not)
+ */
+#define	MACH_MSG_TYPE_INTEGER_T	MACH_MSG_TYPE_INTEGER_32
+
+#endif	/* _MACH_I386_VM_TYPES_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine.h
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2000-2007 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*	File:	machine.h
+ *	Author:	Avadis Tevanian, Jr.
+ *	Date:	1986
+ *
+ *	Machine independent machine abstraction.
+ */
+
+#ifndef	_MACH_MACHINE_H_
+#define _MACH_MACHINE_H_
+
+#include <stdint.h>
+#include <mach/machine/vm_types.h>
+#include <mach/boolean.h>
+
+typedef integer_t	cpu_type_t;
+typedef integer_t	cpu_subtype_t;
+typedef integer_t	cpu_threadtype_t;
+
+#define CPU_STATE_MAX		4
+
+#define CPU_STATE_USER		0
+#define CPU_STATE_SYSTEM	1
+#define CPU_STATE_IDLE		2
+#define CPU_STATE_NICE		3
+
+
+
+/*
+ * Capability bits used in the definition of cpu_type.
+ */
+#define	CPU_ARCH_MASK	0xff000000		/* mask for architecture bits */
+#define CPU_ARCH_ABI64	0x01000000		/* 64 bit ABI */
+
+/*
+ *	Machine types known by all.
+ */
+ 
+#define CPU_TYPE_ANY		((cpu_type_t) -1)
+
+#define CPU_TYPE_VAX		((cpu_type_t) 1)
+/* skip				((cpu_type_t) 2)	*/
+/* skip				((cpu_type_t) 3)	*/
+/* skip				((cpu_type_t) 4)	*/
+/* skip				((cpu_type_t) 5)	*/
+#define	CPU_TYPE_MC680x0	((cpu_type_t) 6)
+#define CPU_TYPE_X86		((cpu_type_t) 7)
+#define CPU_TYPE_I386		CPU_TYPE_X86		/* compatibility */
+#define	CPU_TYPE_X86_64		(CPU_TYPE_X86 | CPU_ARCH_ABI64)
+
+/* skip CPU_TYPE_MIPS		((cpu_type_t) 8)	*/
+/* skip 			((cpu_type_t) 9)	*/
+#define CPU_TYPE_MC98000	((cpu_type_t) 10)
+#define CPU_TYPE_HPPA           ((cpu_type_t) 11)
+#define CPU_TYPE_ARM		((cpu_type_t) 12)
+#define CPU_TYPE_MC88000	((cpu_type_t) 13)
+#define CPU_TYPE_SPARC		((cpu_type_t) 14)
+#define CPU_TYPE_I860		((cpu_type_t) 15)
+/* skip	CPU_TYPE_ALPHA		((cpu_type_t) 16)	*/
+/* skip				((cpu_type_t) 17)	*/
+#define CPU_TYPE_POWERPC		((cpu_type_t) 18)
+#define CPU_TYPE_POWERPC64		(CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
+
+/*
+ *	Machine subtypes (these are defined here, instead of in a machine
+ *	dependent directory, so that any program can get all definitions
+ *	regardless of where is it compiled).
+ */
+
+/*
+ * Capability bits used in the definition of cpu_subtype.
+ */
+#define CPU_SUBTYPE_MASK	0xff000000	/* mask for feature flags */
+#define CPU_SUBTYPE_LIB64	0x80000000	/* 64 bit libraries */
+
+
+/*
+ *	Object files that are hand-crafted to run on any
+ *	implementation of an architecture are tagged with
+ *	CPU_SUBTYPE_MULTIPLE.  This functions essentially the same as
+ *	the "ALL" subtype of an architecture except that it allows us
+ *	to easily find object files that may need to be modified
+ *	whenever a new implementation of an architecture comes out.
+ *
+ *	It is the responsibility of the implementor to make sure the
+ *	software handles unsupported implementations elegantly.
+ */
+#define	CPU_SUBTYPE_MULTIPLE		((cpu_subtype_t) -1)
+#define CPU_SUBTYPE_LITTLE_ENDIAN	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_BIG_ENDIAN		((cpu_subtype_t) 1)
+
+/*
+ *     Machine threadtypes.
+ *     This is none - not defined - for most machine types/subtypes.
+ */
+#define CPU_THREADTYPE_NONE		((cpu_threadtype_t) 0)
+
+/*
+ *	VAX subtypes (these do *not* necessary conform to the actual cpu
+ *	ID assigned by DEC available via the SID register).
+ */
+
+#define	CPU_SUBTYPE_VAX_ALL	((cpu_subtype_t) 0) 
+#define CPU_SUBTYPE_VAX780	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_VAX785	((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_VAX750	((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_VAX730	((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_UVAXI	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_UVAXII	((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_VAX8200	((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_VAX8500	((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_VAX8600	((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_VAX8650	((cpu_subtype_t) 10)
+#define CPU_SUBTYPE_VAX8800	((cpu_subtype_t) 11)
+#define CPU_SUBTYPE_UVAXIII	((cpu_subtype_t) 12)
+
+/*
+ * 	680x0 subtypes
+ *
+ * The subtype definitions here are unusual for historical reasons.
+ * NeXT used to consider 68030 code as generic 68000 code.  For
+ * backwards compatability:
+ * 
+ *	CPU_SUBTYPE_MC68030 symbol has been preserved for source code
+ *	compatability.
+ *
+ *	CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
+ *	subtype as CPU_SUBTYPE_MC68030 for binary comatability.
+ *
+ *	CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
+ *	files to be tagged as containing 68030-specific instructions.
+ */
+
+#define	CPU_SUBTYPE_MC680x0_ALL		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MC68030		((cpu_subtype_t) 1) /* compat */
+#define CPU_SUBTYPE_MC68040		((cpu_subtype_t) 2) 
+#define	CPU_SUBTYPE_MC68030_ONLY	((cpu_subtype_t) 3)
+
+/*
+ *	I386 subtypes
+ */
+
+#define CPU_SUBTYPE_INTEL(f, m)	((cpu_subtype_t) (f) + ((m) << 4))
+
+#define	CPU_SUBTYPE_I386_ALL			CPU_SUBTYPE_INTEL(3, 0)
+#define CPU_SUBTYPE_386					CPU_SUBTYPE_INTEL(3, 0)
+#define CPU_SUBTYPE_486					CPU_SUBTYPE_INTEL(4, 0)
+#define CPU_SUBTYPE_486SX				CPU_SUBTYPE_INTEL(4, 8)	// 8 << 4 = 128
+#define CPU_SUBTYPE_586					CPU_SUBTYPE_INTEL(5, 0)
+#define CPU_SUBTYPE_PENT	CPU_SUBTYPE_INTEL(5, 0)
+#define CPU_SUBTYPE_PENTPRO	CPU_SUBTYPE_INTEL(6, 1)
+#define CPU_SUBTYPE_PENTII_M3	CPU_SUBTYPE_INTEL(6, 3)
+#define CPU_SUBTYPE_PENTII_M5	CPU_SUBTYPE_INTEL(6, 5)
+#define CPU_SUBTYPE_CELERON				CPU_SUBTYPE_INTEL(7, 6)
+#define CPU_SUBTYPE_CELERON_MOBILE		CPU_SUBTYPE_INTEL(7, 7)
+#define CPU_SUBTYPE_PENTIUM_3			CPU_SUBTYPE_INTEL(8, 0)
+#define CPU_SUBTYPE_PENTIUM_3_M			CPU_SUBTYPE_INTEL(8, 1)
+#define CPU_SUBTYPE_PENTIUM_3_XEON		CPU_SUBTYPE_INTEL(8, 2)
+#define CPU_SUBTYPE_PENTIUM_M			CPU_SUBTYPE_INTEL(9, 0)
+#define CPU_SUBTYPE_PENTIUM_4			CPU_SUBTYPE_INTEL(10, 0)
+#define CPU_SUBTYPE_PENTIUM_4_M			CPU_SUBTYPE_INTEL(10, 1)
+#define CPU_SUBTYPE_ITANIUM				CPU_SUBTYPE_INTEL(11, 0)
+#define CPU_SUBTYPE_ITANIUM_2			CPU_SUBTYPE_INTEL(11, 1)
+#define CPU_SUBTYPE_XEON				CPU_SUBTYPE_INTEL(12, 0)
+#define CPU_SUBTYPE_XEON_MP				CPU_SUBTYPE_INTEL(12, 1)
+
+#define CPU_SUBTYPE_INTEL_FAMILY(x)	((x) & 15)
+#define CPU_SUBTYPE_INTEL_FAMILY_MAX	15
+
+#define CPU_SUBTYPE_INTEL_MODEL(x)	((x) >> 4)
+#define CPU_SUBTYPE_INTEL_MODEL_ALL	0
+
+/*
+ *	X86 subtypes.
+ */
+
+#define CPU_SUBTYPE_X86_ALL		((cpu_subtype_t)3)
+#define CPU_SUBTYPE_X86_64_ALL		((cpu_subtype_t)3)
+#define CPU_SUBTYPE_X86_ARCH1		((cpu_subtype_t)4)
+
+
+#define CPU_THREADTYPE_INTEL_HTT	((cpu_threadtype_t) 1)
+
+/*
+ *	Mips subtypes.
+ */
+
+#define	CPU_SUBTYPE_MIPS_ALL	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MIPS_R2300	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MIPS_R2600	((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_MIPS_R2800	((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_MIPS_R2000a	((cpu_subtype_t) 4)	/* pmax */
+#define CPU_SUBTYPE_MIPS_R2000	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_MIPS_R3000a	((cpu_subtype_t) 6)	/* 3max */
+#define CPU_SUBTYPE_MIPS_R3000	((cpu_subtype_t) 7)
+
+/*
+ *	MC98000 (PowerPC) subtypes
+ */
+#define	CPU_SUBTYPE_MC98000_ALL	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MC98601	((cpu_subtype_t) 1)
+
+/*
+ *	HPPA subtypes for Hewlett-Packard HP-PA family of
+ *	risc processors. Port by NeXT to 700 series. 
+ */
+
+#define	CPU_SUBTYPE_HPPA_ALL		((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_HPPA_7100		((cpu_subtype_t) 0) /* compat */
+#define CPU_SUBTYPE_HPPA_7100LC		((cpu_subtype_t) 1)
+
+/*
+ *	MC88000 subtypes.
+ */
+#define	CPU_SUBTYPE_MC88000_ALL	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MC88100	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MC88110	((cpu_subtype_t) 2)
+
+/*
+ *	SPARC subtypes
+ */
+#define	CPU_SUBTYPE_SPARC_ALL		((cpu_subtype_t) 0)
+
+/*
+ *	I860 subtypes
+ */
+#define CPU_SUBTYPE_I860_ALL	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_I860_860	((cpu_subtype_t) 1)
+
+/*
+ *	PowerPC subtypes
+ */
+#define CPU_SUBTYPE_POWERPC_ALL		((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_POWERPC_601		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_POWERPC_602		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_POWERPC_603		((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_POWERPC_603e	((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_POWERPC_603ev	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_POWERPC_604		((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_POWERPC_604e	((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_POWERPC_620		((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_POWERPC_750		((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_POWERPC_7400	((cpu_subtype_t) 10)
+#define CPU_SUBTYPE_POWERPC_7450	((cpu_subtype_t) 11)
+#define CPU_SUBTYPE_POWERPC_970		((cpu_subtype_t) 100)
+
+/*
+ *	ARM subtypes
+ */
+#define CPU_SUBTYPE_ARM_ALL             ((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_ARM_V4T             ((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_ARM_V6              ((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_ARM_V5TEJ           ((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_ARM_XSCALE		((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_ARM_V7		((cpu_subtype_t) 9)
+
+/*
+ *	CPU families (sysctl hw.cpufamily)
+ *
+ * These are meant to identify the CPU's marketing name - an
+ * application can map these to (possibly) localized strings.
+ * NB: the encodings of the CPU families are intentionally arbitrary.
+ * There is no ordering, and you should never try to deduce whether
+ * or not some feature is available based on the family.
+ * Use feature flags (eg, hw.optional.altivec) to test for optional
+ * functionality.
+ */
+#define CPUFAMILY_UNKNOWN   		0
+#define CPUFAMILY_POWERPC_G3		0xcee41549
+#define CPUFAMILY_POWERPC_G4		0x77c184ae
+#define CPUFAMILY_POWERPC_G5		0xed76d8aa
+#define CPUFAMILY_INTEL_6_13		0xaa33392b
+#define CPUFAMILY_INTEL_YONAH		0x73d67300
+#define CPUFAMILY_INTEL_MEROM		0x426f69ef
+#define CPUFAMILY_INTEL_PENRYN		0x78ea4fbc
+#define CPUFAMILY_INTEL_NEHALEM		0x6b5a4cd2
+#define CPUFAMILY_INTEL_WESTMERE	0x573b5eec
+#define CPUFAMILY_INTEL_SANDYBRIDGE	0x5490b78c
+#define CPUFAMILY_ARM_9			0xe73283ae
+#define CPUFAMILY_ARM_11		0x8ff620d8
+#define CPUFAMILY_ARM_XSCALE		0x53b005f5
+#define CPUFAMILY_ARM_13		0x0cc90e64
+#define CPUFAMILY_ARM_14		0x96077ef1
+
+/* The following synonyms are deprecated: */
+#define CPUFAMILY_INTEL_6_14	CPUFAMILY_INTEL_YONAH
+#define CPUFAMILY_INTEL_6_15	CPUFAMILY_INTEL_MEROM
+#define CPUFAMILY_INTEL_6_23	CPUFAMILY_INTEL_PENRYN
+#define CPUFAMILY_INTEL_6_26	CPUFAMILY_INTEL_NEHALEM
+
+#define CPUFAMILY_INTEL_CORE	CPUFAMILY_INTEL_YONAH
+#define CPUFAMILY_INTEL_CORE2	CPUFAMILY_INTEL_MEROM
+
+
+#endif	/* _MACH_MACHINE_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine/boolean.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef _MACH_MACHINE_BOOLEAN_H_
+#define _MACH_MACHINE_BOOLEAN_H_
+
+#if defined (__i386__) || defined(__x86_64__)
+#include "mach/i386/boolean.h"
+#elif defined (__arm__)
+#include "mach/arm/boolean.h"
+#else
+#error architecture not supported
+#endif
+
+#endif /* _MACH_MACHINE_BOOLEAN_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine/thread_state.h
@@ -0,0 +1,9 @@
+/*
+ * This file is a stub with the bare minimum needed to make things work.
+ */
+#ifndef _MACH_MACHINE_THREAD_STATE_H_
+#define _MACH_MACHINE_THREAD_STATE_H_
+
+#define THREAD_STATE_MAX 1
+
+#endif /* _MACH_MACHINE_THREAD_STATE_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine/thread_status.h
@@ -0,0 +1,1 @@
+/* This file intentionally left blank */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine/vm_types.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef _MACH_MACHINE_VM_TYPES_H_
+#define _MACH_MACHINE_VM_TYPES_H_
+
+#if defined (__i386__) || defined(__x86_64__)
+#include "mach/i386/vm_types.h"
+#elif defined (__arm__)
+#include "mach/arm/vm_types.h"
+#else
+#error architecture not supported
+#endif
+
+#endif /* _MACH_MACHINE_VM_TYPES_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/thread_status.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/thread_status.h
+ *	Author:	Avadis Tevanian, Jr.
+ *
+ *	This file contains the structure definitions for the user-visible
+ *	thread state.  This thread state is examined with the thread_get_state
+ *	kernel call and may be changed with the thread_set_state kernel call.
+ *
+ */
+
+#ifndef	_MACH_THREAD_STATUS_H_
+#define	_MACH_THREAD_STATUS_H_
+
+/*
+ *	The actual structure that comprises the thread state is defined
+ *	in the machine dependent module.
+ */
+#include <mach/machine/vm_types.h>
+#include <mach/machine/thread_status.h>
+#include <mach/machine/thread_state.h>
+
+/*
+ *	Generic definition for machine-dependent thread status.
+ */
+
+typedef	natural_t	*thread_state_t;	/* Variable-length array */
+
+/* THREAD_STATE_MAX is now defined in <mach/machine/thread_state.h> */
+typedef	natural_t	thread_state_data_t[THREAD_STATE_MAX];
+
+#define	THREAD_STATE_FLAVOR_LIST	0	/* List of valid flavors */
+#define THREAD_STATE_FLAVOR_LIST_NEW	128
+
+typedef	int			thread_state_flavor_t;
+typedef thread_state_flavor_t	*thread_state_flavor_array_t;
+
+#endif	/* _MACH_THREAD_STATUS_H_ */
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/vm_prot.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/vm_prot.h
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young
+ *
+ *	Virtual memory protection definitions.
+ *
+ */
+
+#ifndef	_MACH_VM_PROT_H_
+#define	_MACH_VM_PROT_H_
+
+/*
+ *	Types defined:
+ *
+ *	vm_prot_t		VM protection values.
+ */
+
+typedef int		vm_prot_t;
+
+/*
+ *	Protection values, defined as bits within the vm_prot_t type
+ */
+
+#define	VM_PROT_NONE	((vm_prot_t) 0x00)
+
+#define VM_PROT_READ	((vm_prot_t) 0x01)	/* read permission */
+#define VM_PROT_WRITE	((vm_prot_t) 0x02)	/* write permission */
+#define VM_PROT_EXECUTE	((vm_prot_t) 0x04)	/* execute permission */
+
+/*
+ *	The default protection for newly-created virtual memory
+ */
+
+#define VM_PROT_DEFAULT	(VM_PROT_READ|VM_PROT_WRITE)
+
+/*
+ *	The maximum privileges possible, for parameter checking.
+ */
+
+#define VM_PROT_ALL	(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
+
+/*
+ *	An invalid protection value.
+ *	Used only by memory_object_lock_request to indicate no change
+ *	to page locks.  Using -1 here is a bad idea because it
+ *	looks like VM_PROT_ALL and then some.
+ */
+
+#define VM_PROT_NO_CHANGE	((vm_prot_t) 0x08)
+
+/* 
+ *      When a caller finds that he cannot obtain write permission on a
+ *      mapped entry, the following flag can be used.  The entry will
+ *      be made "needs copy" effectively copying the object (using COW),
+ *      and write permission will be added to the maximum protections
+ *      for the associated entry. 
+ */        
+
+#define VM_PROT_COPY            ((vm_prot_t) 0x10)
+
+
+/*
+ *	Another invalid protection value.
+ *	Used only by memory_object_data_request upon an object
+ *	which has specified a copy_call copy strategy. It is used
+ *	when the kernel wants a page belonging to a copy of the
+ *	object, and is only asking the object as a result of
+ *	following a shadow chain. This solves the race between pages
+ *	being pushed up by the memory manager and the kernel
+ *	walking down the shadow chain.
+ */
+
+#define VM_PROT_WANTS_COPY	((vm_prot_t) 0x10)
+
+
+/*
+ * 	Another invalid protection value.
+ *	Indicates that the other protection bits are to be applied as a mask
+ *	against the actual protection bits of the map entry.
+ */
+#define VM_PROT_IS_MASK		((vm_prot_t) 0x40)
+
+#endif	/* _MACH_VM_PROT_H_ */
--- a/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/Makefile.in
@@ -1,7 +1,1 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-HOST_LDFLAGS += \
-  -framework Foundation \
-  $(NULL)
+%/dump_syms_tool.mm: ;
rename from toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/dump_syms_tool.mm
rename to toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/dump_syms_tool.cc
--- a/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/dump_syms_tool.mm
+++ b/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/dump_syms_tool.cc
@@ -24,17 +24,17 @@
 // 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.
 
-// dump_syms_tool.mm: Command line tool that uses the DumpSymbols class.
+// dump_syms_tool.cc: Command line tool that uses the DumpSymbols class.
 // TODO(waylonis): accept stdin
 
 #include <mach-o/arch.h>
 #include <unistd.h>
 
 #include <iostream>
 #include <vector>
 
@@ -42,33 +42,33 @@
 #include "common/mac/arch_utilities.h"
 #include "common/mac/macho_utilities.h"
 
 using google_breakpad::DumpSymbols;
 using std::vector;
 
 struct Options {
   Options() : srcPath(), arch(), cfi(true) { }
-  NSString *srcPath;
+  string srcPath;
   const NXArchInfo *arch;
   bool cfi;
 };
 
 //=============================================================================
 static bool Start(const Options &options) {
   DumpSymbols dump_symbols(options.cfi ? ALL_SYMBOL_DATA : NO_CFI);
 
   if (!dump_symbols.Read(options.srcPath))
     return false;
 
   if (options.arch) {
     if (!dump_symbols.SetArchitecture(options.arch->cputype,
                                       options.arch->cpusubtype)) {
       fprintf(stderr, "%s: no architecture '%s' is present in file.\n",
-              [options.srcPath fileSystemRepresentation], options.arch->name);
+              options.srcPath.c_str(), options.arch->name);
       size_t available_size;
       const struct fat_arch *available =
         dump_symbols.AvailableArchitectures(&available_size);
       if (available_size == 1)
         fprintf(stderr, "the file's architecture is: ");
       else
         fprintf(stderr, "architectures present in the file are:\n");
       for (size_t i = 0; i < available_size; i++) {
@@ -131,26 +131,21 @@ static void SetupOptions(int argc, const
   }
 
   if ((argc - optind) != 1) {
     fprintf(stderr, "Must specify Mach-o file\n");
     Usage(argc, argv);
     exit(1);
   }
 
-  options->srcPath = [[NSFileManager defaultManager]
-                       stringWithFileSystemRepresentation:argv[optind]
-                       length:strlen(argv[optind])];
+  options->srcPath = argv[optind];
 }
 
 //=============================================================================
 int main (int argc, const char * argv[]) {
-  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   Options options;
   bool result;
 
   SetupOptions(argc, argv, &options);
   result = Start(options);
 
-  [pool release];
-
   return !result;
 }
--- a/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
@@ -1,23 +1,30 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 HOST_SOURCES += [
-    'dump_syms_tool.mm',
+    'dump_syms_tool.cc',
 ]
 
 HostProgram('dump_syms')
 
+# Order matters here, but HOST_USE_LIBS must be sorted.
+HOST_USE_LIBS += [
+    'host_breakpad_mac_common_s',
+]
 HOST_USE_LIBS += [
     'host_breakpad_common_s',
     'host_breakpad_dwarf_s',
-    'host_breakpad_mac_common_s',
 ]
 
 LOCAL_INCLUDES += [
     '../../..',
     '../../../common/mac',
 ]
 
+if CONFIG['HOST_OS_ARCH'] != 'Darwin':
+    HOST_CXXFLAGS += [
+        '-I%s/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/' % TOPSRCDIR,
+    ]
--- a/tools/profiler/core/shim_mac_dump_syms.mm
+++ b/tools/profiler/core/shim_mac_dump_syms.mm
@@ -8,16 +8,13 @@
 
 bool ReadSymbolData_DARWIN(const string& obj_file,
                            const std::vector<string> &debug_dirs,
                            SymbolData symbol_data,
                            google_breakpad::Module** module)
 {
   google_breakpad::DumpSymbols ds(symbol_data);
 
-  NSString* obj_file_ns = [NSString stringWithUTF8String:obj_file.c_str()];
-  // TODO: remember to [obj_file_ns release] this at the exit points
-
-  if (!ds.Read(obj_file_ns))
+  if (!ds.Read(obj_file))
     return false;
 
   return ds.ReadSymbolData(module);
 }