Change over the broadcaster/listener process to hold shared or weak pointers
to each other.  This should remove some infrequent teardown crashes when the
listener is not the debugger's listener.

Processes now need to take a ListenerSP, not a Listener&.

This required changing over the Process plugin class constructors to take a ListenerSP, instead
of a Listener&.   Other than that there should be no functional change.
 
<rdar://problem/24580184> CrashTracer: [USER] Xcode at …ework: lldb_private::Listener::BroadcasterWillDestruct + 39

llvm-svn: 262863
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 1645294..f03262e2 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -432,8 +432,8 @@
             if (process_sp)
             {
                 EventSP event_sp;
-                Listener &lldb_listener = m_opaque_sp->GetListener();
-                while (lldb_listener.GetNextEventForBroadcaster (process_sp.get(), event_sp))
+                ListenerSP lldb_listener_sp = m_opaque_sp->GetListener();
+                while (lldb_listener_sp->GetNextEventForBroadcaster (process_sp.get(), event_sp))
                 {
                     SBEvent event(event_sp);
                     HandleProcessEvent (process, event, GetOutputFileHandle(), GetErrorFileHandle());
@@ -450,7 +450,7 @@
 
     SBListener sb_listener;
     if (m_opaque_sp)
-        sb_listener.reset(&m_opaque_sp->GetListener(), false);
+        sb_listener.reset(m_opaque_sp->GetListener());
 
     if (log)
         log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)",