diff options
author | Hafiz Abid Qadeer <hafiz_abid@mentor.com> | 2013-08-29 09:09:45 +0000 |
---|---|---|
committer | Hafiz Abid Qadeer <hafiz_abid@mentor.com> | 2013-08-29 09:09:45 +0000 |
commit | 9a78cdf825849463a9f2d3b6543eb6e7974fc225 (patch) | |
tree | 0f15c95da1352cdac9d38fb8738032b88ee7652f /lldb/source/Plugins/Process | |
parent | 0ccd3f61b14e359ce38c0b9e3f5e9ec5c4541e82 (diff) | |
download | bcm5719-llvm-9a78cdf825849463a9f2d3b6543eb6e7974fc225.tar.gz bcm5719-llvm-9a78cdf825849463a9f2d3b6543eb6e7974fc225.zip |
Discover support of 'p' packet.
Some stubs only support g/G packets for registers.
This change makes sure that we check if remote stub supports 'p' packet before using it.
llvm-svn: 189576
Diffstat (limited to 'lldb/source/Plugins/Process')
3 files changed, 26 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 3f702be1b57..05f2d9b31e4 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -55,6 +55,7 @@ GDBRemoteCommunicationClient::GDBRemoteCommunicationClient(bool is_platform) : m_supports_vCont_C (eLazyBoolCalculate), m_supports_vCont_s (eLazyBoolCalculate), m_supports_vCont_S (eLazyBoolCalculate), + m_supports_p (eLazyBoolCalculate), m_qHostInfo_is_valid (eLazyBoolCalculate), m_qProcessInfo_is_valid (eLazyBoolCalculate), m_supports_alloc_dealloc_memory (eLazyBoolCalculate), @@ -200,6 +201,7 @@ GDBRemoteCommunicationClient::ResetDiscoverableSettings() m_supports_vCont_C = eLazyBoolCalculate; m_supports_vCont_s = eLazyBoolCalculate; m_supports_vCont_S = eLazyBoolCalculate; + m_supports_p = eLazyBoolCalculate; m_qHostInfo_is_valid = eLazyBoolCalculate; m_qProcessInfo_is_valid = eLazyBoolCalculate; m_supports_alloc_dealloc_memory = eLazyBoolCalculate; @@ -295,6 +297,24 @@ GDBRemoteCommunicationClient::GetVContSupported (char flavor) return false; } +// Check if the target supports 'p' packet. It sends out a 'p' +// packet and checks the response. A normal packet will tell us +// that support is available. +bool +GDBRemoteCommunicationClient::GetpPacketSupported () +{ + if (m_supports_p == eLazyBoolCalculate) + { + StringExtractorGDBRemote response; + m_supports_p = eLazyBoolNo; + if (SendPacketAndWaitForResponse("p0", response, false)) + { + if (response.IsNormalResponse()) + m_supports_p = eLazyBoolYes; + } + } + return m_supports_p; +} size_t GDBRemoteCommunicationClient::SendPacketAndWaitForResponse diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index c8809cbf445..fc317be2a20 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -228,6 +228,9 @@ public: GetVContSupported (char flavor); bool + GetpPacketSupported (); + + bool GetVAttachOrWaitSupported (); bool @@ -431,6 +434,7 @@ protected: lldb_private::LazyBool m_watchpoints_trigger_after_instruction; lldb_private::LazyBool m_attach_or_wait_reply; lldb_private::LazyBool m_prepare_for_reg_writing_reply; + lldb_private::LazyBool m_supports_p; bool m_supports_qProcessInfoPID:1, diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 38fb84d66ef..b405f03463c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -164,7 +164,6 @@ lldb::RegisterContextSP ThreadGDBRemote::CreateRegisterContextForFrame (StackFrame *frame) { lldb::RegisterContextSP reg_ctx_sp; - const bool read_all_registers_at_once = false; uint32_t concrete_frame_idx = 0; if (frame) @@ -177,6 +176,8 @@ ThreadGDBRemote::CreateRegisterContextForFrame (StackFrame *frame) if (process_sp) { ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get()); + // read_all_registers_at_once will be true if 'p' packet is not supported. + bool read_all_registers_at_once = !gdb_process->GetGDBRemote().GetpPacketSupported (); reg_ctx_sp.reset (new GDBRemoteRegisterContext (*this, concrete_frame_idx, gdb_process->m_register_info, read_all_registers_at_once)); } } |