[Lldb-commits] [lldb] r139975 - in /lldb/trunk: source/Plugins/Process/Utility/StopInfoMachException.cpp source/Plugins/Process/Utility/StopInfoMachException.h source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Johnny Chen johnny.chen at apple.com
Fri Sep 16 18:05:03 PDT 2011


Author: johnny
Date: Fri Sep 16 20:05:03 2011
New Revision: 139975

URL: http://llvm.org/viewvc/llvm-project?rev=139975&view=rev
Log:
Foe x86_64/i386, piggyback the hardware index of the fired watchpoint in the exception
data sent back to the debugger.  On the debugger side, use the opportunity during the
StopInfoMachException::CreateStopReasonWithMachException() method to set the hardware index
for the very watchpoint location.

Modified:
    lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
    lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=139975&r1=139974&r2=139975&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Fri Sep 16 20:05:03 2011
@@ -245,7 +245,8 @@
     uint32_t exc_type, 
     uint32_t exc_data_count,
     uint64_t exc_code,
-    uint64_t exc_sub_code
+    uint64_t exc_sub_code,
+    uint64_t exc_sub_sub_code
 )
 {
     if (exc_type != 0)
@@ -303,10 +304,17 @@
                             return StopInfo::CreateStopReasonToTrace(thread);
 
                         // It's a watchpoint, then.
+                        // The exc_sub_code indicates the data break address.
                         lldb::WatchpointLocationSP wp_loc_sp =
                             thread.GetProcess().GetTarget().GetWatchpointLocationList().FindByAddress((lldb::addr_t)exc_sub_code);
                         if (wp_loc_sp)
+                        {
+                            // Debugserver may piggyback the hardware index of the fired watchpoint in the exception data.
+                            // Set the hardware index if that's the case.
+                            if (exc_data_count >=3)
+                                wp_loc_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
                             return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_loc_sp->GetID());
+                        }
                     }
                     else if (exc_code == 2) // EXC_I386_BPT
                     {

Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.h?rev=139975&r1=139974&r2=139975&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.h Fri Sep 16 20:05:03 2011
@@ -60,7 +60,8 @@
                                        uint32_t exc_type, 
                                        uint32_t exc_data_count,
                                        uint64_t exc_code, 
-                                       uint64_t exc_subcode);
+                                       uint64_t exc_sub_code,
+                                       uint64_t exc_sub_sub_code);
     
 protected:
     uint32_t m_exc_data_count;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=139975&r1=139974&r2=139975&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Sep 16 20:05:03 2011
@@ -1228,7 +1228,8 @@
                                                                                                        exc_type, 
                                                                                                        exc_data_size,
                                                                                                        exc_data_size >= 1 ? exc_data[0] : 0,
-                                                                                                       exc_data_size >= 2 ? exc_data[1] : 0));
+                                                                                                       exc_data_size >= 2 ? exc_data[1] : 0,
+                                                                                                       exc_data_size >= 3 ? exc_data[2] : 0));
                 }
                 else
                 {

Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=139975&r1=139974&r2=139975&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Fri Sep 16 20:05:03 2011
@@ -645,7 +645,11 @@
             nub_addr_t addr = 0;
             uint32_t hw_index = GetHardwareWatchpointHit(addr);
             if (hw_index != INVALID_NUB_HW_INDEX)
+            {
                 exc.exc_data[1] = addr;
+                // Piggyback the hw_index in the exc.data.
+                exc.exc_data.push_back(hw_index);
+            }
 
             return true;
         }

Modified: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=139975&r1=139974&r2=139975&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Fri Sep 16 20:05:03 2011
@@ -574,7 +574,11 @@
                 nub_addr_t addr = 0;
                 uint32_t hw_index = GetHardwareWatchpointHit(addr);
                 if (hw_index != INVALID_NUB_HW_INDEX)
+                {
                     exc.exc_data[1] = addr;
+                    // Piggyback the hw_index in the exc.data.
+                    exc.exc_data.push_back(hw_index);
+                }
 
                 return true;
             }





More information about the lldb-commits mailing list