[Lldb-commits] [PATCH] D11264: [LLGS] Limit jThreadsInfo to only the most important registers for now
Pavel Labath
labath at google.com
Thu Jul 16 07:56:37 PDT 2015
labath created this revision.
labath added reviewers: tberghammer, ovyalov.
labath added a subscriber: lldb-commits.
It seems that reading of register data is the biggest bottleneck in LLGS at the moment. Sending
four registers instead of the full GPR set increases the jThreadsInfo processing time about
6-fold. Until we figure out where is this time going, this commit limits the amount of data we
send to provide a more fluid debugging experience.
http://reviews.llvm.org/D11264
Files:
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -468,19 +468,34 @@
return nullptr;
JSONObject::SP register_object_sp = std::make_shared<JSONObject>();
+
+#ifdef LLDB_JTHREADSINFO_FULL_REGISTER_SET
// Expedite all registers in the first register set (i.e. should be GPRs) that are not contained in other registers.
const RegisterSet *reg_set_p = reg_ctx_sp->GetRegisterSet(0);
if (! reg_set_p)
return nullptr;
-
for (const uint32_t *reg_num_p = reg_set_p->registers; *reg_num_p != LLDB_INVALID_REGNUM; ++reg_num_p)
{
- const RegisterInfo *const reg_info_p = reg_ctx_sp->GetRegisterInfoAtIndex(*reg_num_p);
+ uint32_t reg_num = *reg_num_p;
+#else
+ // Expedite only a couple of registers until we figure out why sending registers is
+ // expensive.
+ static const uint32_t k_expedited_registers[] = {
+ LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_SP, LLDB_REGNUM_GENERIC_FP, LLDB_REGNUM_GENERIC_RA
+ };
+ for (uint32_t generic_reg: k_expedited_registers)
+ {
+ uint32_t reg_num = reg_ctx_sp->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, generic_reg);
+ if (reg_num == LLDB_INVALID_REGNUM)
+ continue; // Target does not support the given register.
+#endif
+
+ const RegisterInfo *const reg_info_p = reg_ctx_sp->GetRegisterInfoAtIndex(reg_num);
if (reg_info_p == nullptr)
{
if (log)
log->Printf("%s failed to get register info for register index %" PRIu32,
- __FUNCTION__, *reg_num_p);
+ __FUNCTION__, reg_num);
continue;
}
@@ -493,15 +508,15 @@
{
if (log)
log->Printf("%s failed to read register '%s' index %" PRIu32 ": %s", __FUNCTION__,
- reg_info_p->name ? reg_info_p->name : "<unnamed-register>", *reg_num_p,
+ reg_info_p->name ? reg_info_p->name : "<unnamed-register>", reg_num,
error.AsCString ());
continue;
}
StreamString stream;
WriteRegisterValueInHexFixedWidth(stream, reg_ctx_sp, *reg_info_p, ®_value);
- register_object_sp->SetObject(std::to_string(*reg_num_p),
+ register_object_sp->SetObject(std::to_string(reg_num),
std::make_shared<JSONString>(stream.GetString()));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11264.29908.patch
Type: text/x-patch
Size: 2681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150716/a36ac650/attachment.bin>
More information about the lldb-commits
mailing list