mozilla-ucontext.patch
branchfirefox52
changeset 989 a72735108dbe
equal deleted inserted replaced
988:85024ab72ccb 989:a72735108dbe
       
     1 Index: mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
       
     2 ===================================================================
       
     3 --- mozilla.orig/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
       
     4 +++ mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
       
     5 @@ -40,15 +40,15 @@ namespace google_breakpad {
       
     6  
       
     7  #if defined(__i386__)
       
     8  
       
     9 -uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
       
    10 +uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
       
    11    return uc->uc_mcontext.gregs[REG_ESP];
       
    12  }
       
    13  
       
    14 -uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
       
    15 +uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
       
    16    return uc->uc_mcontext.gregs[REG_EIP];
       
    17  }
       
    18  
       
    19 -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
       
    20 +void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
       
    21                                      const struct _libc_fpstate* fp) {
       
    22    const greg_t* regs = uc->uc_mcontext.gregs;
       
    23  
       
    24 @@ -88,15 +88,15 @@ void UContextReader::FillCPUContext(RawC
       
    25  
       
    26  #elif defined(__x86_64)
       
    27  
       
    28 -uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
       
    29 +uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
       
    30    return uc->uc_mcontext.gregs[REG_RSP];
       
    31  }
       
    32  
       
    33 -uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
       
    34 +uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
       
    35    return uc->uc_mcontext.gregs[REG_RIP];
       
    36  }
       
    37  
       
    38 -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
       
    39 +void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
       
    40                                      const struct _libc_fpstate* fpregs) {
       
    41    const greg_t* regs = uc->uc_mcontext.gregs;
       
    42  
       
    43 @@ -145,15 +145,15 @@ void UContextReader::FillCPUContext(RawC
       
    44  
       
    45  #elif defined(__ARM_EABI__)
       
    46  
       
    47 -uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
       
    48 +uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
       
    49    return uc->uc_mcontext.arm_sp;
       
    50  }
       
    51  
       
    52 -uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
       
    53 +uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
       
    54    return uc->uc_mcontext.arm_pc;
       
    55  }
       
    56  
       
    57 -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
       
    58 +void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
       
    59    out->context_flags = MD_CONTEXT_ARM_FULL;
       
    60  
       
    61    out->iregs[0] = uc->uc_mcontext.arm_r0;
       
    62 @@ -184,15 +184,15 @@ void UContextReader::FillCPUContext(RawC
       
    63  
       
    64  #elif defined(__aarch64__)
       
    65  
       
    66 -uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
       
    67 +uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
       
    68    return uc->uc_mcontext.sp;
       
    69  }
       
    70  
       
    71 -uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
       
    72 +uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
       
    73    return uc->uc_mcontext.pc;
       
    74  }
       
    75  
       
    76 -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
       
    77 +void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
       
    78                                      const struct fpsimd_context* fpregs) {
       
    79    out->context_flags = MD_CONTEXT_ARM64_FULL;
       
    80  
       
    81 @@ -210,15 +210,15 @@ void UContextReader::FillCPUContext(RawC
       
    82  
       
    83  #elif defined(__mips__)
       
    84  
       
    85 -uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
       
    86 +uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
       
    87    return uc->uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP];
       
    88  }
       
    89  
       
    90 -uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
       
    91 +uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
       
    92    return uc->uc_mcontext.pc;
       
    93  }
       
    94  
       
    95 -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
       
    96 +void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
       
    97  #if _MIPS_SIM == _ABI64
       
    98    out->context_flags = MD_CONTEXT_MIPS64_FULL;
       
    99  #elif _MIPS_SIM == _ABIO32
       
   100 Index: mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
       
   101 ===================================================================
       
   102 --- mozilla.orig/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
       
   103 +++ mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
       
   104 @@ -41,21 +41,21 @@ namespace google_breakpad {
       
   105  
       
   106  // Wraps platform-dependent implementations of accessors to ucontext structs.
       
   107  struct UContextReader {
       
   108 -  static uintptr_t GetStackPointer(const struct ucontext* uc);
       
   109 +  static uintptr_t GetStackPointer(const ucontext_t* uc);
       
   110  
       
   111 -  static uintptr_t GetInstructionPointer(const struct ucontext* uc);
       
   112 +  static uintptr_t GetInstructionPointer(const ucontext_t* uc);
       
   113  
       
   114    // Juggle a arch-specific ucontext into a minidump format
       
   115    //   out: the minidump structure
       
   116    //   info: the collection of register structures.
       
   117  #if defined(__i386__) || defined(__x86_64)
       
   118 -  static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
       
   119 +  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
       
   120                               const struct _libc_fpstate* fp);
       
   121  #elif defined(__aarch64__)
       
   122 -  static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
       
   123 +  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
       
   124                               const struct fpsimd_context* fpregs);
       
   125  #else
       
   126 -  static void FillCPUContext(RawContextCPU *out, const ucontext *uc);
       
   127 +  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc);
       
   128  #endif
       
   129  };
       
   130  
       
   131 Index: mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
       
   132 ===================================================================
       
   133 --- mozilla.orig/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
       
   134 +++ mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
       
   135 @@ -439,9 +439,9 @@ bool ExceptionHandler::HandleSignal(int
       
   136    // Fill in all the holes in the struct to make Valgrind happy.
       
   137    memset(&g_crash_context_, 0, sizeof(g_crash_context_));
       
   138    memcpy(&g_crash_context_.siginfo, info, sizeof(siginfo_t));
       
   139 -  memcpy(&g_crash_context_.context, uc, sizeof(struct ucontext));
       
   140 +  memcpy(&g_crash_context_.context, uc, sizeof(ucontext_t));
       
   141  #if defined(__aarch64__)
       
   142 -  struct ucontext* uc_ptr = (struct ucontext*)uc;
       
   143 +  ucontext_t* uc_ptr = (ucontext_t*)uc;
       
   144    struct fpsimd_context* fp_ptr =
       
   145        (struct fpsimd_context*)&uc_ptr->uc_mcontext.__reserved;
       
   146    if (fp_ptr->head.magic == FPSIMD_MAGIC) {
       
   147 @@ -452,7 +452,7 @@ bool ExceptionHandler::HandleSignal(int
       
   148    // FP state is not part of user ABI on ARM Linux.
       
   149    // In case of MIPS Linux FP state is already part of struct ucontext
       
   150    // and 'float_state' is not a member of CrashContext.
       
   151 -  struct ucontext* uc_ptr = (struct ucontext*)uc;
       
   152 +  ucontext_t* uc_ptr = (ucontext_t*)uc;
       
   153    if (uc_ptr->uc_mcontext.fpregs) {
       
   154      memcpy(&g_crash_context_.float_state, uc_ptr->uc_mcontext.fpregs,
       
   155             sizeof(g_crash_context_.float_state));
       
   156 @@ -476,7 +476,7 @@ bool ExceptionHandler::SimulateSignalDel
       
   157    // ExceptionHandler::HandleSignal().
       
   158    siginfo.si_code = SI_USER;
       
   159    siginfo.si_pid = getpid();
       
   160 -  struct ucontext context;
       
   161 +  ucontext_t context;
       
   162    getcontext(&context);
       
   163    return HandleSignal(sig, &siginfo, &context);
       
   164  }
       
   165 Index: mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.h
       
   166 ===================================================================
       
   167 --- mozilla.orig/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.h
       
   168 +++ mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.h
       
   169 @@ -191,7 +191,7 @@ class ExceptionHandler {
       
   170    struct CrashContext {
       
   171      siginfo_t siginfo;
       
   172      pid_t tid;  // the crashing thread.
       
   173 -    struct ucontext context;
       
   174 +    ucontext_t context;
       
   175  #if !defined(__ARM_EABI__) && !defined(__mips__)
       
   176      // #ifdef this out because FP state is not part of user ABI for Linux ARM.
       
   177      // In case of MIPS Linux FP state is already part of struct
       
   178 Index: mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/microdump_writer/microdump_writer.cc
       
   179 ===================================================================
       
   180 --- mozilla.orig/toolkit/crashreporter/google-breakpad/src/client/linux/microdump_writer/microdump_writer.cc
       
   181 +++ mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/microdump_writer/microdump_writer.cc
       
   182 @@ -571,7 +571,7 @@ class MicrodumpWriter {
       
   183  
       
   184    void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
       
   185  
       
   186 -  const struct ucontext* const ucontext_;
       
   187 +  const ucontext_t* const ucontext_;
       
   188  #if !defined(__ARM_EABI__) && !defined(__mips__)
       
   189    const google_breakpad::fpstate_t* const float_state_;
       
   190  #endif
       
   191 Index: mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/minidump_writer.cc
       
   192 ===================================================================
       
   193 --- mozilla.orig/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/minidump_writer.cc
       
   194 +++ mozilla/toolkit/crashreporter/google-breakpad/src/client/linux/minidump_writer/minidump_writer.cc
       
   195 @@ -1247,7 +1247,7 @@ class MinidumpWriter {
       
   196    const int fd_;  // File descriptor where the minidum should be written.
       
   197    const char* path_;  // Path to the file where the minidum should be written.
       
   198  
       
   199 -  const struct ucontext* const ucontext_;  // also from the signal handler
       
   200 +  const ucontext_t* const ucontext_;  // also from the signal handler
       
   201  #if !defined(__ARM_EABI__) && !defined(__mips__)
       
   202    const google_breakpad::fpstate_t* const float_state_;  // ditto
       
   203  #endif