Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 628782
Collapse All | Expand All

(-)a/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc (-16 / +16 lines)
Lines 36-54 namespace google_breakpad { Link Here
36
36
37
// Minidump defines register structures which are different from the raw
37
// Minidump defines register structures which are different from the raw
38
// structures which we get from the kernel. These are platform specific
38
// structures which we get from the kernel. These are platform specific
39
// functions to juggle the ucontext and user structures into minidump format.
39
// functions to juggle the ucontext_t and user structures into minidump format.
40
40
41
#if defined(__i386__)
41
#if defined(__i386__)
42
42
43
uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
43
uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
44
  return uc->uc_mcontext.gregs[REG_ESP];
44
  return uc->uc_mcontext.gregs[REG_ESP];
45
}
45
}
46
46
47
uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
47
uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
48
  return uc->uc_mcontext.gregs[REG_EIP];
48
  return uc->uc_mcontext.gregs[REG_EIP];
49
}
49
}
50
50
51
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
51
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
52
                                    const struct _libc_fpstate* fp) {
52
                                    const struct _libc_fpstate* fp) {
53
  const greg_t* regs = uc->uc_mcontext.gregs;
53
  const greg_t* regs = uc->uc_mcontext.gregs;
54
54
Lines 88-102 void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc, Link Here
88
88
89
#elif defined(__x86_64)
89
#elif defined(__x86_64)
90
90
91
uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
91
uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
92
  return uc->uc_mcontext.gregs[REG_RSP];
92
  return uc->uc_mcontext.gregs[REG_RSP];
93
}
93
}
94
94
95
uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
95
uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
96
  return uc->uc_mcontext.gregs[REG_RIP];
96
  return uc->uc_mcontext.gregs[REG_RIP];
97
}
97
}
98
98
99
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
99
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
100
                                    const struct _libc_fpstate* fpregs) {
100
                                    const struct _libc_fpstate* fpregs) {
101
  const greg_t* regs = uc->uc_mcontext.gregs;
101
  const greg_t* regs = uc->uc_mcontext.gregs;
102
102
Lines 145-159 void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc, Link Here
145
145
146
#elif defined(__ARM_EABI__)
146
#elif defined(__ARM_EABI__)
147
147
148
uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
148
uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
149
  return uc->uc_mcontext.arm_sp;
149
  return uc->uc_mcontext.arm_sp;
150
}
150
}
151
151
152
uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
152
uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
153
  return uc->uc_mcontext.arm_pc;
153
  return uc->uc_mcontext.arm_pc;
154
}
154
}
155
155
156
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
156
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
157
  out->context_flags = MD_CONTEXT_ARM_FULL;
157
  out->context_flags = MD_CONTEXT_ARM_FULL;
158
158
159
  out->iregs[0] = uc->uc_mcontext.arm_r0;
159
  out->iregs[0] = uc->uc_mcontext.arm_r0;
Lines 184-198 void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) { Link Here
184
184
185
#elif defined(__aarch64__)
185
#elif defined(__aarch64__)
186
186
187
uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
187
uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
188
  return uc->uc_mcontext.sp;
188
  return uc->uc_mcontext.sp;
189
}
189
}
190
190
191
uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
191
uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
192
  return uc->uc_mcontext.pc;
192
  return uc->uc_mcontext.pc;
193
}
193
}
194
194
195
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
195
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
196
                                    const struct fpsimd_context* fpregs) {
196
                                    const struct fpsimd_context* fpregs) {
197
  out->context_flags = MD_CONTEXT_ARM64_FULL;
197
  out->context_flags = MD_CONTEXT_ARM64_FULL;
198
198
Lines 210-224 void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc, Link Here
210
210
211
#elif defined(__mips__)
211
#elif defined(__mips__)
212
212
213
uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
213
uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
214
  return uc->uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP];
214
  return uc->uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP];
215
}
215
}
216
216
217
uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
217
uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
218
  return uc->uc_mcontext.pc;
218
  return uc->uc_mcontext.pc;
219
}
219
}
220
220
221
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
221
void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
222
#if _MIPS_SIM == _ABI64
222
#if _MIPS_SIM == _ABI64
223
  out->context_flags = MD_CONTEXT_MIPS64_FULL;
223
  out->context_flags = MD_CONTEXT_MIPS64_FULL;
224
#elif _MIPS_SIM == _ABIO32
224
#elif _MIPS_SIM == _ABIO32
(-)a/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h (-7 / +7 lines)
Lines 39-61 Link Here
39
39
40
namespace google_breakpad {
40
namespace google_breakpad {
41
41
42
// Wraps platform-dependent implementations of accessors to ucontext structs.
42
// Wraps platform-dependent implementations of accessors to ucontext_t structs.
43
struct UContextReader {
43
struct UContextReader {
44
  static uintptr_t GetStackPointer(const struct ucontext* uc);
44
  static uintptr_t GetStackPointer(const ucontext_t* uc);
45
45
46
  static uintptr_t GetInstructionPointer(const struct ucontext* uc);
46
  static uintptr_t GetInstructionPointer(const ucontext_t* uc);
47
47
48
  // Juggle a arch-specific ucontext into a minidump format
48
  // Juggle a arch-specific ucontext_t into a minidump format
49
  //   out: the minidump structure
49
  //   out: the minidump structure
50
  //   info: the collection of register structures.
50
  //   info: the collection of register structures.
51
#if defined(__i386__) || defined(__x86_64)
51
#if defined(__i386__) || defined(__x86_64)
52
  static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
52
  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
53
                             const struct _libc_fpstate* fp);
53
                             const struct _libc_fpstate* fp);
54
#elif defined(__aarch64__)
54
#elif defined(__aarch64__)
55
  static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
55
  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
56
                             const struct fpsimd_context* fpregs);
56
                             const struct fpsimd_context* fpregs);
57
#else
57
#else
58
  static void FillCPUContext(RawContextCPU *out, const ucontext *uc);
58
  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc);
59
#endif
59
#endif
60
};
60
};
61
61
(-)a/breakpad/src/client/linux/handler/exception_handler.cc (-5 / +5 lines)
Lines 457-465 bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) { Link Here
457
  // Fill in all the holes in the struct to make Valgrind happy.
457
  // Fill in all the holes in the struct to make Valgrind happy.
458
  memset(&g_crash_context_, 0, sizeof(g_crash_context_));
458
  memset(&g_crash_context_, 0, sizeof(g_crash_context_));
459
  memcpy(&g_crash_context_.siginfo, info, sizeof(siginfo_t));
459
  memcpy(&g_crash_context_.siginfo, info, sizeof(siginfo_t));
460
  memcpy(&g_crash_context_.context, uc, sizeof(struct ucontext));
460
  memcpy(&g_crash_context_.context, uc, sizeof(ucontext_t));
461
#if defined(__aarch64__)
461
#if defined(__aarch64__)
462
  struct ucontext* uc_ptr = (struct ucontext*)uc;
462
  ucontext_t* uc_ptr = (ucontext_t*)uc;
463
  struct fpsimd_context* fp_ptr =
463
  struct fpsimd_context* fp_ptr =
464
      (struct fpsimd_context*)&uc_ptr->uc_mcontext.__reserved;
464
      (struct fpsimd_context*)&uc_ptr->uc_mcontext.__reserved;
465
  if (fp_ptr->head.magic == FPSIMD_MAGIC) {
465
  if (fp_ptr->head.magic == FPSIMD_MAGIC) {
Lines 468-476 bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) { Link Here
468
  }
468
  }
469
#elif !defined(__ARM_EABI__) && !defined(__mips__)
469
#elif !defined(__ARM_EABI__) && !defined(__mips__)
470
  // FP state is not part of user ABI on ARM Linux.
470
  // FP state is not part of user ABI on ARM Linux.
471
  // In case of MIPS Linux FP state is already part of struct ucontext
471
  // In case of MIPS Linux FP state is already part of ucontext_t
472
  // and 'float_state' is not a member of CrashContext.
472
  // and 'float_state' is not a member of CrashContext.
473
  struct ucontext* uc_ptr = (struct ucontext*)uc;
473
  ucontext_t* uc_ptr = (ucontext_t*)uc;
474
  if (uc_ptr->uc_mcontext.fpregs) {
474
  if (uc_ptr->uc_mcontext.fpregs) {
475
    memcpy(&g_crash_context_.float_state, uc_ptr->uc_mcontext.fpregs,
475
    memcpy(&g_crash_context_.float_state, uc_ptr->uc_mcontext.fpregs,
476
           sizeof(g_crash_context_.float_state));
476
           sizeof(g_crash_context_.float_state));
Lines 494-500 bool ExceptionHandler::SimulateSignalDelivery(int sig) { Link Here
494
  // ExceptionHandler::HandleSignal().
494
  // ExceptionHandler::HandleSignal().
495
  siginfo.si_code = SI_USER;
495
  siginfo.si_code = SI_USER;
496
  siginfo.si_pid = getpid();
496
  siginfo.si_pid = getpid();
497
  struct ucontext context;
497
  ucontext_t context;
498
  getcontext(&context);
498
  getcontext(&context);
499
  return HandleSignal(sig, &siginfo, &context);
499
  return HandleSignal(sig, &siginfo, &context);
500
}
500
}
(-)a/breakpad/src/client/linux/handler/exception_handler.h (-2 / +2 lines)
Lines 191-201 class ExceptionHandler { Link Here
191
  struct CrashContext {
191
  struct CrashContext {
192
    siginfo_t siginfo;
192
    siginfo_t siginfo;
193
    pid_t tid;  // the crashing thread.
193
    pid_t tid;  // the crashing thread.
194
    struct ucontext context;
194
    ucontext_t context;
195
#if !defined(__ARM_EABI__) && !defined(__mips__)
195
#if !defined(__ARM_EABI__) && !defined(__mips__)
196
    // #ifdef this out because FP state is not part of user ABI for Linux ARM.
196
    // #ifdef this out because FP state is not part of user ABI for Linux ARM.
197
    // In case of MIPS Linux FP state is already part of struct
197
    // In case of MIPS Linux FP state is already part of struct
198
    // ucontext so 'float_state' is not required.
198
    // ucontext_t so 'float_state' is not required.
199
    fpstate_t float_state;
199
    fpstate_t float_state;
200
#endif
200
#endif
201
  };
201
  };
(-)a/breakpad/src/client/linux/microdump_writer/microdump_writer.cc (-1 / +1 lines)
Lines 593-599 class MicrodumpWriter { Link Here
593
593
594
  void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
594
  void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
595
595
596
  const struct ucontext* const ucontext_;
596
  const ucontext_t* const ucontext_;
597
#if !defined(__ARM_EABI__) && !defined(__mips__)
597
#if !defined(__ARM_EABI__) && !defined(__mips__)
598
  const google_breakpad::fpstate_t* const float_state_;
598
  const google_breakpad::fpstate_t* const float_state_;
599
#endif
599
#endif
(-)a/breakpad/src/client/linux/minidump_writer/minidump_writer.cc (-1 / +1 lines)
Lines 1323-1329 class MinidumpWriter { Link Here
1323
  const int fd_;  // File descriptor where the minidum should be written.
1323
  const int fd_;  // File descriptor where the minidum should be written.
1324
  const char* path_;  // Path to the file where the minidum should be written.
1324
  const char* path_;  // Path to the file where the minidum should be written.
1325
1325
1326
  const struct ucontext* const ucontext_;  // also from the signal handler
1326
  const ucontext_t* const ucontext_;  // also from the signal handler
1327
#if !defined(__ARM_EABI__) && !defined(__mips__)
1327
#if !defined(__ARM_EABI__) && !defined(__mips__)
1328
  const google_breakpad::fpstate_t* const float_state_;  // ditto
1328
  const google_breakpad::fpstate_t* const float_state_;  // ditto
1329
#endif
1329
#endif

Return to bug 628782