~itachi-san/telegram-desktop/breakpad

« back to all changes in this revision

Viewing changes to src/client/linux/dump_writer_common/thread_info.cc

  • Committer: Joshua Peraza
  • Author(s): Thomas Gales
  • Date: 2023-05-23 15:24:16 UTC
  • Revision ID: git-v1:64a53c190426fe582999ac7cfc4c4a5d24084795
Modify RISCV minidump context to match Crashpad

- RISCV32 will only include support for 32 bit floating point registers
- RISCV64 will only include support for 64 bit floating point registers
- RISCV 32/64 context will include a "version" field to account for
  future extensions

Fixed: 1447862

Tested: `make check` on x86 host
Tested: `minidump_stackwalk` for RISCV64 minidump on x86 host
Change-Id: I605d5b2c35e627a5dc986aaf818a9c9898f6ae0b
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4553281
Reviewed-by: Joshua Peraza <jperaza@chromium.org>

Show diffs side-by-side

added added

removed removed

Lines of Context:
322
322
  out->t5  = mcontext.__gregs[30];
323
323
  out->t6  = mcontext.__gregs[31];
324
324
 
325
 
# if __riscv_flen == 32
326
 
  for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
327
 
    out->float_save.regs[i] = mcontext.__fpregs.__f.__f[i];
328
 
  out->float_save.fpcsr = mcontext.__fpregs.__f.__fcsr;
329
 
# elif __riscv_flen == 64
330
 
  for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
331
 
    out->float_save.regs[i] = mcontext.__fpregs.__d.__f[i];
332
 
  out->float_save.fpcsr = mcontext.__fpregs.__d.__fcsr;
333
 
# elif __riscv_flen == 128
334
 
  for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++) {
335
 
    out->float_save.regs[i].high = mcontext.__fpregs.__q.__f[2*i];
336
 
    out->float_save.regs[i].low  = mcontext.__fpregs.__q.__f[2*i+1];
337
 
  }
338
 
  out->float_save.fpcsr = mcontext.__fpregs.__q.__fcsr;
339
 
# else
340
 
#  error "Unexpected __riscv_flen"
341
 
# endif
 
325
  // Breakpad only supports RISCV32 with 32 bit floating point.
 
326
  // Breakpad only supports RISCV64 with 64 bit floating point.
 
327
#if __riscv_xlen == 32
 
328
  for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
 
329
    out->fpregs[i] = mcontext.__fpregs.__f.__f[i];
 
330
  out->fcsr = mcontext.__fpregs.__f.__fcsr;
 
331
#elif __riscv_xlen == 64
 
332
  for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
 
333
    out->fpregs[i] = mcontext.__fpregs.__d.__f[i];
 
334
  out->fcsr = mcontext.__fpregs.__d.__fcsr;
 
335
#else
 
336
#error "Unexpected __riscv_xlen"
 
337
#endif
342
338
}
343
339
#endif  // __riscv
344
340