bug 673789 - Fix Breakpad compilation on OS X 10.7 SDK by #ifdefing out PPC support when targeting 10.7. r=ted
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Mon, 25 Jul 2011 19:15:00 -0400
changeset 74574 3a7ad3683fbf476c7fc1dfae3bf4985402f04dee
parent 74573 6953340878aaaab11a6c5a39d2852f31e284868e
child 74575 d0978a2e87fd099e51cc04df3fdb21d7647f2f2c
push id67
push userclegnitto@mozilla.com
push dateFri, 04 Nov 2011 22:39:41 +0000
treeherdermozilla-release@04778346a3b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs673789
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 673789 - Fix Breakpad compilation on OS X 10.7 SDK by #ifdefing out PPC support when targeting 10.7. r=ted
toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc
toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h
--- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc
+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.cc
@@ -28,26 +28,30 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <algorithm>
 #include <cstdio>
 
 #include <mach/host_info.h>
 #include <mach/i386/thread_status.h>
 #include <mach/mach_vm.h>
-#include <mach/ppc/thread_status.h>
 #include <mach/vm_statistics.h>
 #include <mach-o/dyld.h>
 #include <mach-o/loader.h>
 #include <sys/sysctl.h>
 #include <sys/resource.h>
 
 #include <CoreFoundation/CoreFoundation.h>
 
 #include "client/mac/handler/minidump_generator.h"
+
+#ifdef HAS_PPC_SUPPORT
+#include <mach/ppc/thread_status.h>
+#endif
+
 #include "client/minidump_file_writer-inl.h"
 #include "common/mac/file_id.h"
 #include "common/mac/string_utilities.h"
 
 using MacStringUtils::ConvertToString;
 using MacStringUtils::IntegerValueAtIndex;
 
 namespace google_breakpad {
@@ -331,62 +335,69 @@ bool MinidumpGenerator::WriteStackFromSt
   stack_location->memory = memory.location();
 
   return result;
 }
 
 bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state,
                                    MDMemoryDescriptor *stack_location) {
   switch (cpu_type_) {
+#ifdef HAS_PPC_SUUPORT
     case CPU_TYPE_POWERPC:
       return WriteStackPPC(state, stack_location);
     case CPU_TYPE_POWERPC64:
       return WriteStackPPC64(state, stack_location);
+#endif
     case CPU_TYPE_I386:
       return WriteStackX86(state, stack_location);
     case CPU_TYPE_X86_64:
       return WriteStackX86_64(state, stack_location);
     default:
       return false;
   }
 }
 
 bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state,
                                      MDLocationDescriptor *register_location) {
   switch (cpu_type_) {
+#ifdef HAS_PPC_SUPPORT
     case CPU_TYPE_POWERPC:
       return WriteContextPPC(state, register_location);
     case CPU_TYPE_POWERPC64:
       return WriteContextPPC64(state, register_location);
+#endif
     case CPU_TYPE_I386:
       return WriteContextX86(state, register_location);
     case CPU_TYPE_X86_64:
       return WriteContextX86_64(state, register_location);
     default:
       return false;
   }
 }
 
 u_int64_t MinidumpGenerator::CurrentPCForStack(
     breakpad_thread_state_data_t state) {
   switch (cpu_type_) {
+#ifdef HAS_PPC_SUPPORT
     case CPU_TYPE_POWERPC:
       return CurrentPCForStackPPC(state);
     case CPU_TYPE_POWERPC64:
       return CurrentPCForStackPPC64(state);
+#endif
     case CPU_TYPE_I386:
       return CurrentPCForStackX86(state);
     case CPU_TYPE_X86_64:
       return CurrentPCForStackX86_64(state);
     default:
       assert("Unknown CPU type!");
       return 0;
   }
 }
 
+#ifdef HAS_PCC_SUPPORT
 bool MinidumpGenerator::WriteStackPPC(breakpad_thread_state_data_t state,
                                       MDMemoryDescriptor *stack_location) {
   ppc_thread_state_t *machine_state =
       reinterpret_cast<ppc_thread_state_t *>(state);
   mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, r1);
   return WriteStackFromStartAddress(start_addr, stack_location);
 }
 
@@ -534,16 +545,18 @@ bool MinidumpGenerator::WriteContextPPC6
   AddGPR(30);
   AddGPR(31);
 #undef AddReg
 #undef AddGPR
 
   return true;
 }
 
+#endif
+
 bool MinidumpGenerator::WriteStackX86(breakpad_thread_state_data_t state,
                                    MDMemoryDescriptor *stack_location) {
   i386_thread_state_t *machine_state =
       reinterpret_cast<i386_thread_state_t *>(state);
 
   mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, esp);
   return WriteStackFromStartAddress(start_addr, stack_location);
 }
@@ -658,22 +671,24 @@ bool MinidumpGenerator::WriteContextX86_
   return true;
 }
 
 bool MinidumpGenerator::GetThreadState(thread_act_t target_thread,
                                        thread_state_t state,
                                        mach_msg_type_number_t *count) {
   thread_state_flavor_t flavor;
   switch (cpu_type_) {
+#ifdef HAS_PPC_SUPPORT
     case CPU_TYPE_POWERPC:
       flavor = PPC_THREAD_STATE;
       break;
     case CPU_TYPE_POWERPC64:
       flavor = PPC_THREAD_STATE64;
       break;
+#endif
     case CPU_TYPE_I386:
       flavor = i386_THREAD_STATE;
       break;
     case CPU_TYPE_X86_64:
       flavor = x86_THREAD_STATE64;
       break;
     default:
       return false;
--- a/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h
+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_generator.h
@@ -38,16 +38,20 @@
 
 #include "client/minidump_file_writer.h"
 #include "common/memory.h"
 #include "common/mac/macho_utilities.h"
 #include "google_breakpad/common/minidump_format.h"
 
 #include "dynamic_images.h"
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
+  #define HAS_PPC_SUPPORT
+#endif
+
 namespace google_breakpad {
 
 using std::string;
 
 const u_int64_t TOP_OF_THREAD0_STACK_64BIT = 0x00007fff5fbff000LL;
 const u_int32_t TOP_OF_THREAD0_STACK_32BIT = 0xbffff000;
 
 // Use the REGISTER_FROM_THREADSTATE to access a register name from the
@@ -123,26 +127,28 @@ class MinidumpGenerator {
   bool WriteThreadStream(mach_port_t thread_id, MDRawThread *thread);
   bool WriteCVRecord(MDRawModule *module, int cpu_type, 
                      const char *module_path);
   bool WriteModuleStream(unsigned int index, MDRawModule *module);
   size_t CalculateStackSize(mach_vm_address_t start_addr);
   int  FindExecutableModule();
 
   // Per-CPU implementations of these methods
+#ifdef HAS_PPC_SUPPORT
   bool WriteStackPPC(breakpad_thread_state_data_t state,
                      MDMemoryDescriptor *stack_location);
   bool WriteContextPPC(breakpad_thread_state_data_t state,
                        MDLocationDescriptor *register_location);
   u_int64_t CurrentPCForStackPPC(breakpad_thread_state_data_t state);
   bool WriteStackPPC64(breakpad_thread_state_data_t state,
                        MDMemoryDescriptor *stack_location);
   bool WriteContextPPC64(breakpad_thread_state_data_t state,
                        MDLocationDescriptor *register_location);
   u_int64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state);
+#endif
   bool WriteStackX86(breakpad_thread_state_data_t state,
                        MDMemoryDescriptor *stack_location);
   bool WriteContextX86(breakpad_thread_state_data_t state,
                        MDLocationDescriptor *register_location);
   u_int64_t CurrentPCForStackX86(breakpad_thread_state_data_t state);
   bool WriteStackX86_64(breakpad_thread_state_data_t state,
                         MDMemoryDescriptor *stack_location);
   bool WriteContextX86_64(breakpad_thread_state_data_t state,