diff options
author | Pavel Labath <labath@google.com> | 2015-10-26 16:25:28 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2015-10-26 16:25:28 +0000 |
commit | c4645bb0e653b85e2b41ce00c0f62a398d154f77 (patch) | |
tree | 6431cf262b68b7478fce85a45ef0244b708ab7b6 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | |
parent | df985afa149aa083eb6ab23872681fa4af15dbca (diff) | |
download | llvm-c4645bb0e653b85e2b41ce00c0f62a398d154f77.zip llvm-c4645bb0e653b85e2b41ce00c0f62a398d154f77.tar.gz llvm-c4645bb0e653b85e2b41ce00c0f62a398d154f77.tar.bz2 |
[lldb-server] Send PC of every thread along in the stop-reply packet
This avoids the need to query the PC for private resume operations (public resumes have the PC
from the bigger jStopInfo packet) and speeds up the stepping on an android target by about 10%
(it some cases even more).
llvm-svn: 251301
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index b0d931b..c082372 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -426,7 +426,7 @@ WriteRegisterValueInHexFixedWidth (StreamString &response, } static JSONObject::SP -GetRegistersAsJSON(NativeThreadProtocol &thread) +GetRegistersAsJSON(NativeThreadProtocol &thread, bool abridged) { Log *log (GetLogIfAnyCategoriesSet (LIBLLDB_LOG_THREAD)); @@ -448,11 +448,17 @@ GetRegistersAsJSON(NativeThreadProtocol &thread) // 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 + LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_SP, LLDB_REGNUM_GENERIC_FP, LLDB_REGNUM_GENERIC_RA, LLDB_INVALID_REGNUM }; - for (uint32_t generic_reg: k_expedited_registers) + static const uint32_t k_abridged_expedited_registers[] = { + LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM + }; + + for (const uint32_t *generic_reg_p = abridged ? k_abridged_expedited_registers : k_expedited_registers; + *generic_reg_p != LLDB_INVALID_REGNUM; + ++generic_reg_p) { - uint32_t reg_num = reg_ctx_sp->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, generic_reg); + uint32_t reg_num = reg_ctx_sp->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, *generic_reg_p); if (reg_num == LLDB_INVALID_REGNUM) continue; // Target does not support the given register. #endif @@ -518,7 +524,7 @@ GetStopReasonString(StopReason stop_reason) } static JSONArray::SP -GetJSONThreadsInfo(NativeProcessProtocol &process, bool threads_with_valid_stop_info_only) +GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged) { Log *log (GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); @@ -551,12 +557,12 @@ GetJSONThreadsInfo(NativeProcessProtocol &process, bool threads_with_valid_stop_ tid_stop_info.details.exception.type); } - if (threads_with_valid_stop_info_only && tid_stop_info.reason == eStopReasonNone) - continue; // No stop reason, skip this thread completely. - JSONObject::SP thread_obj_sp = std::make_shared<JSONObject>(); threads_array_sp->AppendObject(thread_obj_sp); + if (JSONObject::SP registers_sp = GetRegistersAsJSON(*thread_sp, abridged)) + thread_obj_sp->SetObject("registers", registers_sp); + thread_obj_sp->SetObject("tid", std::make_shared<JSONNumber>(tid)); if (signum != 0) thread_obj_sp->SetObject("signal", std::make_shared<JSONNumber>(uint64_t(signum))); @@ -585,12 +591,6 @@ GetJSONThreadsInfo(NativeProcessProtocol &process, bool threads_with_valid_stop_ thread_obj_sp->SetObject("medata", medata_array_sp); } - if (threads_with_valid_stop_info_only) - continue; // Only send the abridged stop info. - - if (JSONObject::SP registers_sp = GetRegistersAsJSON(*thread_sp)) - thread_obj_sp->SetObject("registers", registers_sp); - // TODO: Expedite interesting regions of inferior memory } |