[Lldb-commits] [lldb] r189576 - Discover support of 'p' packet.

Sean Callanan scallanan at apple.com
Wed Sep 4 15:06:28 PDT 2013


I’ve investigated, and it looks to me like this commit breaks Mac OS X LLDB’s ability to write registers.
–
[r189575]
(lldb) reg write rdx 0x03
(lldb) reg read rdx
     rdx = 0x0000000000000003

[r189576]
(lldb) reg write rdx 0x03
error: Failed to write register 'rdx' with value '0x03'
–
We should figure out what’s going on or roll this back as soon as possible, because that breaks the expression command on OS X among other things.

Sean

On Aug 29, 2013, at 2:09 AM, Hafiz Abid Qadeer <hafiz_abid at mentor.com> wrote:

> Author: abidh
> Date: Thu Aug 29 04:09:45 2013
> New Revision: 189576
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=189576&view=rev
> Log:
> 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.
> 
> Modified:
>    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
>    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
>    lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
> 
> Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=189576&r1=189575&r2=189576&view=diff
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
> +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu Aug 29 04:09:45 2013
> @@ -55,6 +55,7 @@ GDBRemoteCommunicationClient::GDBRemoteC
>     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::ResetDisco
>     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::GetVContSu
>     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
> 
> Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=189576&r1=189575&r2=189576&view=diff
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
> +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Thu Aug 29 04:09:45 2013
> @@ -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,
> 
> Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=189576&r1=189575&r2=189576&view=diff
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
> +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Aug 29 04:09:45 2013
> @@ -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::CreateRegisterContextFo
>         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));
>         }
>     }
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130904/9b11a94b/attachment.html>


More information about the lldb-commits mailing list