<div dir="ltr">This should fix the issue where multiple Rendezvous breakpoints could get set, get confused about the Rendezvous state, and then things head south.<div><br></div><div>Also resolve the address in <span style="font-family:arial,sans-serif;font-size:13px">BreakpointLocationList FindByAddress (thanks Jim for that pointer).</span></div>

<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><font face="arial, sans-serif">All the Linux tests run fine with this patch. Please let me know if it's ok to commit. Thanks.</font></div>

<div><font face="arial, sans-serif"> -Mike<br></font><div class="gmail_quote"><br><a href="http://llvm-reviews.chandlerc.com/D1145" target="_blank">http://llvm-reviews.chandlerc.com/D1145</a><br>
<br>
Files:<br>
  source/Breakpoint/BreakpointLocationList.cpp<br>
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp<br>
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h<br>
<br>
Index: source/Breakpoint/BreakpointLocationList.cpp<br>
===================================================================<br>
--- source/Breakpoint/BreakpointLocationList.cpp<br>
+++ source/Breakpoint/BreakpointLocationList.cpp<br>
@@ -14,7 +14,9 @@<br>
 // Project includes<br>
 #include "lldb/Breakpoint/BreakpointLocationList.h"<br>
 #include "lldb/Breakpoint/BreakpointLocation.h"<br>
+#include "lldb/Breakpoint/Breakpoint.h"<br>
 #include "lldb/Core/Section.h"<br>
+#include "lldb/Target/Target.h"<br>
<br>
 using namespace lldb;<br>
 using namespace lldb_private;<br>
@@ -114,7 +116,24 @@<br>
     BreakpointLocationSP bp_loc_sp;<br>
     if (!m_locations.empty())<br>
     {<br>
-        addr_map::const_iterator pos = m_address_to_location.find (addr);<br>
+        Address so_addr;<br>
+<br>
+        if (addr.IsSectionOffset())<br>
+        {<br>
+            so_addr = addr;<br>
+        }<br>
+        else<br>
+        {<br>
+            // Try and resolve as a load address if possible.<br>
+            m_owner.GetTarget().GetSectionLoadList().ResolveLoadAddress (addr.GetOffset(), so_addr);<br>
+            if (!so_addr.IsValid())<br>
+            {<br>
+                // The address didn't resolve, so just set to passed in addr.<br>
+                so_addr = addr;<br>
+            }<br>
+        }<br>
+<br>
+        addr_map::const_iterator pos = m_address_to_location.find (so_addr);<br>
         if (pos != m_address_to_location.end())<br>
             bp_loc_sp = pos->second;<br>
     }<br>
Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp<br>
===================================================================<br>
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp<br>
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp<br>
@@ -263,13 +263,19 @@<br>
 void<br>
 DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint()<br>
 {<br>
-    Breakpoint *dyld_break;<br>
-    addr_t break_addr;<br>
+    addr_t break_addr = m_rendezvous.GetBreakAddress();<br>
<br>
-    break_addr = m_rendezvous.GetBreakAddress();<br>
-    dyld_break = m_process->GetTarget().CreateBreakpoint(break_addr, true).get();<br>
-    dyld_break->SetCallback(RendezvousBreakpointHit, this, true);<br>
-    dyld_break->SetBreakpointKind ("shared-library-event");<br>
+    if (m_dyld_break_bp_sp)<br>
+    {<br>
+        // If we've already got a breakpoint, make sure it's pointing to the right address.<br>
+        assert (m_dyld_break_bp_sp->FindLocationIDByAddress(break_addr) != LLDB_INVALID_BREAK_ID);<br>
+        return;<br>
+    }<br>
+<br>
+    // Breakpoint *dyld_break;<br>
+    m_dyld_break_bp_sp = m_process->GetTarget().CreateBreakpoint(break_addr, true);<br>
+    m_dyld_break_bp_sp->SetCallback(RendezvousBreakpointHit, this, true);<br>
+    m_dyld_break_bp_sp->SetBreakpointKind ("shared-library-event");<br>
 }<br>
<br>
 bool<br>
Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h<br>
===================================================================<br>
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h<br>
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h<br>
@@ -92,6 +92,9 @@<br>
     /// Auxiliary vector of the inferior process.<br>
     std::unique_ptr<AuxVector> m_auxv;<br>
<br>
+    /// Rendezvous breakpoint.<br>
+    lldb::BreakpointSP m_dyld_break_bp_sp;<br>
+<br>
     /// Enables a breakpoint on a function called by the runtime<br>
     /// linker each time a module is loaded or unloaded.<br>
     void<br>
</div><br></div></div>