Patch from Pawel Worach to make FreeBSD work again after ModuleSpec changes.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151532 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
index 8a77ce5..41dc93c 100644
--- a/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ b/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -31,10 +31,15 @@
 //------------------------------------------------------------------------------
 // Static functions.
 
-Process*
-ProcessFreeBSD::CreateInstance(Target& target, Listener &listener)
+lldb::ProcessSP
+ProcessFreeBSD::CreateInstance(Target& target,
+                               Listener &listener,
+                               const FileSpec *crash_file_path)
 {
-    return new ProcessFreeBSD(target, listener);
+    lldb::ProcessSP process_sp;
+    if (crash_file_path == NULL)
+        process_sp.reset(new ProcessFreeBSD (target, listener));
+    return process_sp;
 }
 
 void
diff --git a/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h b/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
index 9a511b9..304fa4c 100644
--- a/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
+++ b/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
@@ -31,9 +31,10 @@
     //------------------------------------------------------------------
     // Static functions.
     //------------------------------------------------------------------
-    static Process*
+    static lldb::ProcessSP
     CreateInstance(lldb_private::Target& target,
-                   lldb_private::Listener &listener);
+                   lldb_private::Listener &listener,
+                   const lldb_private::FileSpec *crash_file_path);
 
     static void
     Initialize();
@@ -51,7 +52,7 @@
     // Constructors and destructors
     //------------------------------------------------------------------
     ProcessFreeBSD(lldb_private::Target& target,
-                 lldb_private::Listener &listener);
+                   lldb_private::Listener &listener);
 
     virtual uint32_t
     UpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list);
diff --git a/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
index 796265a..bece1b2 100644
--- a/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ b/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -831,6 +831,7 @@
 {
     ProcessMonitor *monitor = args->m_monitor;
     ProcessFreeBSD &process = monitor->GetProcess();
+    lldb::ProcessSP processSP = process.shared_from_this();
     const char **argv = args->m_argv;
     const char **envp = args->m_envp;
     const char *stdin_path = args->m_stdin_path;
@@ -951,7 +952,7 @@
         goto FINISH;
 
     // Update the process thread list with this new thread.
-    inferior.reset(new POSIXThread(process, pid));
+    inferior.reset(new POSIXThread(processSP, pid));
     process.GetThreadList().AddThread(inferior);
 
     // Let our process instance know the thread has stopped.
@@ -1011,6 +1012,7 @@
 
     ProcessMonitor *monitor = args->m_monitor;
     ProcessFreeBSD &process = monitor->GetProcess();
+    lldb::ProcessSP processSP = process.shared_from_this();
     ThreadList &tl = process.GetThreadList();
     lldb::ThreadSP inferior;
 
@@ -1036,7 +1038,7 @@
     }
 
     // Update the process thread list with the attached thread.
-    inferior.reset(new POSIXThread(process, pid));
+    inferior.reset(new POSIXThread(processSP, pid));
     tl.AddThread(inferior);
 
     // Let our process instance know the thread has stopped.