diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4257,7 +4257,8 @@
reg_info.name.SetString(value);
} else if (name == "bitsize") {
if (llvm::to_integer(value, reg_info.byte_size))
- reg_info.byte_size /= CHAR_BIT;
+ reg_info.byte_size =
+ llvm::divideCeil(reg_info.byte_size, CHAR_BIT);
} else if (name == "type") {
gdb_type = value.str();
} else if (name == "group") {
@@ -4319,7 +4320,11 @@
assert(dwarf_opcode_len == ret_val);
UNUSED_IF_ASSERT_DISABLED(ret_val);
} else {
- printf("unhandled attribute %s = %s\n", name.data(), value.data());
+ Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(
+ GDBR_LOG_PROCESS));
+ LLDB_LOGF(log,
+ "ProcessGDBRemote::%s unhandled reg attribute %s = %s",
+ __FUNCTION__, name.data(), value.data());
}
return true; // Keep iterating through all attributes
});
@@ -4353,8 +4358,15 @@
}
}
- assert(reg_info.byte_size != 0);
- registers.push_back(reg_info);
+ if (reg_info.byte_size == 0) {
+ Log *log(
+ ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+ LLDB_LOGF(log,
+ "ProcessGDBRemote::%s Skipping zero bitsize register %s",
+ __FUNCTION__, reg_info.name.AsCString());
+ } else
+ registers.push_back(reg_info);
+
return true; // Keep iterating through all "reg" elements
});
return true;
diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py b/lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
--- a/lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
@@ -38,6 +38,10 @@
+
+
+
+
@@ -87,7 +91,7 @@
return "E01"
def readRegisters(self):
- return "20000000f8360020001000002fcb0008f8360020a0360020200c0020000000000000000000000000000000000000000000000000b87f0120b7d100082ed2000800000001b87f01200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+ return "20000000f8360020001000002fcb0008f8360020a0360020200c0020000000000000000000000000000000000000000000000000b87f0120b7d100082ed20008addebeafbc00000001b87f01200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
def haltReason(self):
return "S05"
@@ -129,3 +133,15 @@
pc_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("pc")
self.assertEqual(pc_valobj.GetValueAsUnsigned(), 0x0800d22e)
+
+ sys_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("SYS0")
+ self.assertEqual(sys_valobj.GetValueAsUnsigned(), 0xdead)
+
+ sys_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("SYS1")
+ self.assertEqual(sys_valobj.GetValueAsUnsigned(), 0xbe)
+
+ sys_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("SYS2")
+ self.assertEqual(sys_valobj.GetValueAsUnsigned(), 0xaf)
+
+ sys_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("SYS3")
+ self.assertEqual(sys_valobj.GetValueAsUnsigned(), 0xbc)