31      uintptr_t pc, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14,
 
   32          x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28,
 
   51  inline uintptr_t pc()
 const { 
return gp.pc; }
 
   52  inline void setPC(uintptr_t pc) { gp.pc = pc; }
 
   54  inline uintptr_t retval()
 const { 
return gp.x1; }
 
   57  inline void getGPState(GPRegisterValueVector ®s)
 const {
 
   60    std::transform(std::next(std::begin(gp.regs)), std::end(gp.regs),
 
   61                   std::back_inserter(regs),
 
   63                     return GPRegisterValue{sizeof(reg), reg};
 
   68  inline void setGPState(std::vector<uintptr_t> 
const ®s) {
 
   69    for (
size_t reg = 1, nregs = std::min(std::size(regs), std::size(gp.regs));
 
   71      gp.regs[reg % (std::size(gp.regs) - 1)] = regs[reg];
 
   75  inline void getStopGPState(GPRegisterStopMap ®s, 
bool forLLDB)
 const {
 
   77    using namespace ds2::Architecture::RISCV32;
 
   78#elif __riscv_xlen == 64 
   79    using namespace ds2::Architecture::RISCV64;
 
   80#elif __riscv_xlen == 128 
   81    using namespace ds2::Architecture::RISCV128;
 
   86      for (
size_t reg = 1, nregs = std::size(gp.regs); reg < nregs; ++reg)
 
   87        regs[reg_lldb_x0 + reg] =
 
   88            GPRegisterValue{
sizeof(uintptr_t), gp.regs[reg]};
 
   89        regs[reg_lldb_pc] = GPRegisterValue{
sizeof(uintptr_t), gp.pc};
 
   91      regs[reg_gdb_x0] = GPRegisterValue{
sizeof(uintptr_t), 0};
 
   92      for (
size_t reg = 1, nregs = std::size(gp.regs); reg < nregs; ++reg)
 
   93        regs[reg_gdb_x0 + reg] =
 
   94            GPRegisterValue{
sizeof(uintptr_t), gp.regs[reg]};
 
   95        regs[reg_gdb_pc] = GPRegisterValue{
sizeof(uintptr_t), gp.pc};
 
  100  inline bool getLLDBRegisterPtr(
int regno, 
void **ptr, 
size_t *length)
 const {
 
  101#if __riscv_xlen == 32 
  102    using namespace ds2::Architecture::RISCV32;
 
  103#elif __riscv_xlen == 64 
  104    using namespace ds2::Architecture::RISCV64;
 
  105#elif __riscv_xlen == 128 
  106    using namespace ds2::Architecture::RISCV128;
 
  109    if (regno >= reg_lldb_x1 && regno <= reg_lldb_x31) {
 
  110      *ptr = 
const_cast<uintptr_t *
>(&gp.regs[regno - reg_lldb_x1]);
 
  111      *length = 
sizeof(gp.regs[0]);
 
  112    } 
else if (regno == reg_lldb_pc) {
 
  113      *ptr = 
const_cast<uintptr_t *
>(&gp.pc);
 
  114      *length = 
sizeof(gp.pc);
 
  115    } 
else if (regno >= reg_lldb_f0 && regno <= reg_lldb_f31) {
 
  116#if __riscv_flen == 32 
  117      *ptr = 
const_cast<uint32_t *
>(&fp.sng[regno - reg_lldb_f0]);
 
  118      *length = 
sizeof(fp.sng[0]);
 
  119#elif __riscv_flen == 64 
  120      *ptr = 
const_cast<uint64_t *
>(&fp.dbl[regno - reg_lldb_f0]);
 
  121      *length = 
sizeof(fp.dbl[0]);
 
  122#elif __riscv_flen == 128 
  123#error "quad precision floating point support unimplemented" 
  127    } 
else if (regno == reg_lldb_fcsr) {
 
  128      *ptr = 
const_cast<uint32_t *
>(&fp.fcsr);
 
  129      *length = 
sizeof(fp.fcsr);
 
  136  inline bool getGDBRegisterPtr(
int regno, 
void **ptr, 
size_t *length)
 const {
 
  137#if __riscv_xlen == 32 
  138    using namespace ds2::Architecture::RISCV32;
 
  139#elif __riscv_xlen == 64 
  140    using namespace ds2::Architecture::RISCV64;
 
  141#elif __riscv_xlen == 128 
  142    using namespace ds2::Architecture::RISCV128;
 
  145    if (regno >= reg_gdb_x1 && regno <= reg_gdb_x31) {
 
  146      *ptr = 
const_cast<uintptr_t *
>(&gp.regs[regno - reg_gdb_x1]);
 
  147      *length = 
sizeof(gp.regs[0]);
 
  148    } 
else if (regno == reg_gdb_pc) {
 
  149      *ptr = 
const_cast<uintptr_t *
>(&gp.pc);
 
  150      *length = 
sizeof(gp.pc);
 
  151    } 
else if (regno >= reg_gdb_f0 && regno <= reg_gdb_f31) {
 
  152#if __riscv_flen == 32 
  153      *ptr = 
const_cast<uint32_t *
>(&fp.sng[regno - reg_gdb_f0]);
 
  154      *length = 
sizeof(fp.sng[0]);
 
  155#elif __riscv_flen == 64 
  156      *ptr = 
const_cast<uint64_t *
>(&fp.dbl[regno - reg_gdb_f0]);
 
  157      *length = 
sizeof(fp.dbl[0]);
 
  158#elif __riscv_flen == 128 
  159#error "quad precision floating point support unimplemented" 
  163    } 
else if (regno == reg_gdb_fcsr) {
 
  164      *ptr = 
const_cast<uint32_t *
>(&fp.fcsr);
 
  165      *length = 
sizeof(fp.fcsr);