[Lldb-commits] [PATCH] D111131: [LLDB] Round XML register bitsize to byte boundary
Muhammad Omair Javaid via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 6 01:55:25 PDT 2021
omjavaid updated this revision to Diff 377470.
omjavaid added a comment.
This addresses review comments converts printfs to log messages.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111131/new/
https://reviews.llvm.org/D111131
Files:
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
Index: lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
===================================================================
--- lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
@@ -38,6 +38,10 @@
<reg name="sp" bitsize="32" type="data_ptr" group="general"/>
<reg name="lr" bitsize="32" type="uint32" group="general"/>
<reg name="pc" bitsize="32" type="code_ptr" group="general"/>
+ <reg name="SYS0" bitsize="9" regnum="21" type="uint32" group="system"/>
+ <reg name="SYS1" bitsize="8" regnum="22" type="uint32" group="system"/>
+ <reg name="SYS2" bitsize="1" regnum="23" type="uint32" group="system"/>
+ <reg name="SYS3" bitsize="7" regnum="24" type="uint32" group="system"/>
<reg name="xpsr" bitsize="32" regnum="25" type="uint32" group="general"/>
<reg name="MSP" bitsize="32" regnum="26" type="uint32" group="general"/>
<reg name="PSP" bitsize="32" regnum="27" type="uint32" group="general"/>
@@ -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)
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111131.377470.patch
Type: text/x-patch
Size: 5090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211006/7054d7f5/attachment-0001.bin>
More information about the lldb-commits
mailing list