Index: lldb/include/lldb/Target/DynamicRegisterInfo.h =================================================================== --- lldb/include/lldb/Target/DynamicRegisterInfo.h +++ lldb/include/lldb/Target/DynamicRegisterInfo.h @@ -77,9 +77,13 @@ const lldb_private::RegisterInfo * GetRegisterInfo(llvm::StringRef reg_name) const; + typedef std::vector reg_collection; + llvm::iterator_range Registers() { + return llvm::iterator_range(m_regs); + } + protected: // Classes that inherit from DynamicRegisterInfo can see and modify these - typedef std::vector reg_collection; typedef std::vector set_collection; typedef std::vector reg_num_collection; typedef std::vector set_reg_num_collection; Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -210,16 +210,11 @@ SetAllRegisterValid(true); return true; } else if (buffer_sp->GetByteSize() > 0) { - const int regcount = m_reg_info_sp->GetNumRegisters(); - for (int i = 0; i < regcount; i++) { - struct RegisterInfo *reginfo = - m_reg_info_sp->GetRegisterInfoAtIndex(i); - if (reginfo->byte_offset + reginfo->byte_size <= - buffer_sp->GetByteSize()) { - m_reg_valid[i] = true; - } else { - m_reg_valid[i] = false; - } + for (auto x : llvm::enumerate(m_reg_info_sp->Registers())) { + const struct RegisterInfo ®info = x.value(); + m_reg_valid[x.index()] = + (reginfo.byte_offset + reginfo.byte_size <= + buffer_sp->GetByteSize()); } m_gpacket_cached = true;