omjavaid updated this revision to Diff 271534.
omjavaid added a comment.
This patch is now independent of SVE register support and is only a requirement
for the case of where remote stub utilizes xml register description and sends
register nos which are not consecutively placed.
This patch ensures eRegisterKindProcessPlugin is used while referring to
value_regs/invalidate_regs. This is needed because remote stubs may send target
xml packets with stub specific register numbering scheme. Thus value_regs and
invalidate_regs may have been populated based on a foreign register numbering
scheme. We fix this by converting value_reg/invalidate_reg number to lldb
register number before querying appropriate register info.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77043/new/
https://reviews.llvm.org/D77043
Files:
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
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
@@ -242,11 +242,15 @@
// Index of the primordial register.
bool success = true;
for (uint32_t idx = 0; success; ++idx) {
- const uint32_t prim_reg = reg_info->value_regs[idx];
+ uint32_t prim_reg = reg_info->value_regs[idx];
if (prim_reg == LLDB_INVALID_REGNUM)
break;
// We have a valid primordial register as our constituent. Grab the
// corresponding register info.
+ uint32_t regnum = ConvertRegisterKindToRegisterNumber(
+ eRegisterKindProcessPlugin, prim_reg);
+ if (regnum != LLDB_INVALID_REGNUM)
+ prim_reg = regnum;
const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg);
if (prim_reg_info == nullptr)
success = false;
@@ -375,11 +379,15 @@
// Invalidate this composite register first.
for (uint32_t idx = 0; success; ++idx) {
- const uint32_t reg = reg_info->value_regs[idx];
+ uint32_t reg = reg_info->value_regs[idx];
if (reg == LLDB_INVALID_REGNUM)
break;
// We have a valid primordial register as our constituent. Grab the
// corresponding register info.
+ uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber(
+ eRegisterKindProcessPlugin, reg);
+ if (lldb_regnum != LLDB_INVALID_REGNUM)
+ reg = lldb_regnum;
const RegisterInfo *value_reg_info = GetRegisterInfoAtIndex(reg);
if (value_reg_info == nullptr)
success = false;
@@ -397,6 +405,10 @@
for (uint32_t idx = 0, reg = reg_info->invalidate_regs[0];
reg != LLDB_INVALID_REGNUM;
reg = reg_info->invalidate_regs[++idx]) {
+ uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber(
+ eRegisterKindProcessPlugin, reg);
+ if (lldb_regnum != LLDB_INVALID_REGNUM)
+ reg = lldb_regnum;
SetRegisterIsValid(reg, false);
}
}
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
@@ -242,11 +242,15 @@
// Index of the primordial register.
bool success = true;
for (uint32_t idx = 0; success; ++idx) {
- const uint32_t prim_reg = reg_info->value_regs[idx];
+ uint32_t prim_reg = reg_info->value_regs[idx];
if (prim_reg == LLDB_INVALID_REGNUM)
break;
// We have a valid primordial register as our constituent. Grab the
// corresponding register info.
+ uint32_t regnum = ConvertRegisterKindToRegisterNumber(
+ eRegisterKindProcessPlugin, prim_reg);
+ if (regnum != LLDB_INVALID_REGNUM)
+ prim_reg = regnum;
const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg);
if (prim_reg_info == nullptr)
success = false;
@@ -375,11 +379,15 @@
// Invalidate this composite register first.
for (uint32_t idx = 0; success; ++idx) {
- const uint32_t reg = reg_info->value_regs[idx];
+ uint32_t reg = reg_info->value_regs[idx];
if (reg == LLDB_INVALID_REGNUM)
break;
// We have a valid primordial register as our constituent. Grab the
// corresponding register info.
+ uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber(
+ eRegisterKindProcessPlugin, reg);
+ if (lldb_regnum != LLDB_INVALID_REGNUM)
+ reg = lldb_regnum;
const RegisterInfo *value_reg_info = GetRegisterInfoAtIndex(reg);
if (value_reg_info == nullptr)
success = false;
@@ -397,6 +405,10 @@
for (uint32_t idx = 0, reg = reg_info->invalidate_regs[0];
reg != LLDB_INVALID_REGNUM;
reg = reg_info->invalidate_regs[++idx]) {
+ uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber(
+ eRegisterKindProcessPlugin, reg);
+ if (lldb_regnum != LLDB_INVALID_REGNUM)
+ reg = lldb_regnum;
SetRegisterIsValid(reg, false);
}
}
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits