[llvm-branch-commits] [lldb] r244965 - Merging r244865:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 13 15:10:42 PDT 2015


Author: hans
Date: Thu Aug 13 17:10:42 2015
New Revision: 244965

URL: http://llvm.org/viewvc/llvm-project?rev=244965&view=rev
Log:
Merging r244865:
------------------------------------------------------------------------
r244865 | jaydeep | 2015-08-12 20:46:01 -0700 (Wed, 12 Aug 2015) | 8 lines

[LLDB][MIPS] Support standard GDB remote stop reply packet for watchpoint
    SUMMARY:
    The patch supports TAAwatch:addr packet. The patch also sets m_watchpoints_trigger_after_instruction 
    to eLazyBoolNo when qHostInfo or qWatchpointSupportInfo is not supported by the target.
    
    Reviewers: jingham, clayborg
    Subscribers: nitesh.jain, mohit.bhakkad, sagar, bhushan and lldb-commits
    Differential Revision: http://reviews.llvm.org/D11747
------------------------------------------------------------------------

Modified:
    lldb/branches/release_37/   (props changed)
    lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Propchange: lldb/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 13 17:10:42 2015
@@ -1,3 +1,3 @@
 /lldb/branches/apple/python-GIL:156467-162159
 /lldb/branches/iohandler:198360-200250
-/lldb/trunk:242306,242381,242525,242529,243091,243618,244006,244864
+/lldb/trunk:242306,242381,242525,242529,243091,243618,244006,244864-244865

Modified: lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=244965&r1=244964&r2=244965&view=diff
==============================================================================
--- lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu Aug 13 17:10:42 2015
@@ -2472,26 +2472,45 @@ GDBRemoteCommunicationClient::GetWatchpo
 }
 
 lldb_private::Error
-GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num, bool& after)
+GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num, bool& after, const ArchSpec &arch)
 {
     Error error(GetWatchpointSupportInfo(num));
     if (error.Success())
-        error = GetWatchpointsTriggerAfterInstruction(after);
+        error = GetWatchpointsTriggerAfterInstruction(after, arch);
     return error;
 }
 
 lldb_private::Error
-GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction (bool &after)
+GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction (bool &after, const ArchSpec &arch)
 {
     Error error;
+    llvm::Triple::ArchType atype = arch.GetMachine();
     
     // we assume watchpoints will happen after running the relevant opcode
     // and we only want to override this behavior if we have explicitly
     // received a qHostInfo telling us otherwise
     if (m_qHostInfo_is_valid != eLazyBoolYes)
-        after = true;
+    {
+        // On targets like MIPS, watchpoint exceptions are always generated 
+        // before the instruction is executed. The connected target may not 
+        // support qHostInfo or qWatchpointSupportInfo packets.
+        if (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel
+            || atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el)
+            after = false;
+        else
+            after = true;
+    }
     else
+    {
+        // For MIPS, set m_watchpoints_trigger_after_instruction to eLazyBoolNo 
+        // if it is not calculated before.
+        if (m_watchpoints_trigger_after_instruction == eLazyBoolCalculate &&
+            (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel
+            || atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el))
+            m_watchpoints_trigger_after_instruction = eLazyBoolNo;
+
         after = (m_watchpoints_trigger_after_instruction != eLazyBoolNo);
+    }
     return error;
 }
 

Modified: lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=244965&r1=244964&r2=244965&view=diff
==============================================================================
--- lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/branches/release_37/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Thu Aug 13 17:10:42 2015
@@ -287,10 +287,10 @@ public:
     GetWatchpointSupportInfo (uint32_t &num); 
 
     Error
-    GetWatchpointSupportInfo (uint32_t &num, bool& after);
+    GetWatchpointSupportInfo (uint32_t &num, bool& after, const ArchSpec &arch);
     
     Error
-    GetWatchpointsTriggerAfterInstruction (bool &after);
+    GetWatchpointsTriggerAfterInstruction (bool &after, const ArchSpec &arch);
 
     const ArchSpec &
     GetHostArchitecture ();

Modified: lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=244965&r1=244964&r2=244965&view=diff
==============================================================================
--- lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Aug 13 17:10:42 2015
@@ -2440,6 +2440,21 @@ ProcessGDBRemote::SetThreadStopInfo (Str
                         }
                     }
                 }
+                else if (key.compare("watch") == 0 || key.compare("rwatch") == 0 || key.compare("awatch") == 0)
+                {
+                    // Support standard GDB remote stop reply packet 'TAAwatch:addr'
+                    lldb::addr_t wp_addr = StringConvert::ToUInt64 (value.c_str(), LLDB_INVALID_ADDRESS, 16);
+                    WatchpointSP wp_sp = GetTarget().GetWatchpointList().FindByAddress(wp_addr);
+                    uint32_t wp_index = LLDB_INVALID_INDEX32;
+
+                    if (wp_sp)
+                        wp_index = wp_sp->GetHardwareIndex();
+
+                    reason = "watchpoint";
+                    StreamString ostr;
+                    ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
+                    description = ostr.GetString().c_str();
+                }
                 else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1]))
                 {
                     uint32_t reg = StringConvert::ToUInt32 (key.c_str(), UINT32_MAX, 16);
@@ -3012,7 +3027,7 @@ ProcessGDBRemote::GetWatchpointSupportIn
 Error
 ProcessGDBRemote::GetWatchpointSupportInfo (uint32_t &num, bool& after)
 {
-    Error error (m_gdb_comm.GetWatchpointSupportInfo (num, after));
+    Error error (m_gdb_comm.GetWatchpointSupportInfo (num, after, GetTarget().GetArchitecture()));
     return error;
 }
 




More information about the llvm-branch-commits mailing list