[Lldb-commits] [lldb] r151532 - in /lldb/trunk/source/Plugins: Platform/FreeBSD/PlatformFreeBSD.cpp Platform/FreeBSD/PlatformFreeBSD.h Process/FreeBSD/ProcessFreeBSD.cpp Process/FreeBSD/ProcessFreeBSD.h Process/FreeBSD/ProcessMonitor.cpp

Greg Clayton gclayton at apple.com
Mon Feb 27 10:40:48 PST 2012


Author: gclayton
Date: Mon Feb 27 12:40:48 2012
New Revision: 151532

URL: http://llvm.org/viewvc/llvm-project?rev=151532&view=rev
Log:
Patch from Pawel Worach to make FreeBSD work again after ModuleSpec changes.


Modified:
    lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
    lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp

Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=151532&r1=151531&r2=151532&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Mon Feb 27 12:40:48 2012
@@ -101,7 +101,8 @@
 Error
 PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
                                     const ArchSpec &exe_arch,
-                                    lldb::ModuleSP &exe_module_sp)
+                                    lldb::ModuleSP &exe_module_sp,
+                                    const FileSpecList *module_search_paths_ptr)
 {
     Error error;
     // Nothing special to do here, just use the actual file and architecture
@@ -139,7 +140,8 @@
         {
             error = m_remote_platform_sp->ResolveExecutable (exe_file,
                                                              exe_arch,
-                                                             exe_module_sp);
+                                                             exe_module_sp,
+                                                             module_search_paths_ptr);
         }
         else
         {
@@ -161,14 +163,12 @@
 
     if (error.Success())
     {
-        if (exe_arch.IsValid())
+        ModuleSpec module_spec (resolved_exe_file, exe_arch);
+        if (module_spec.GetArchitecture().IsValid())
         {
-            error = ModuleList::GetSharedModule (resolved_exe_file,
-                                                 exe_arch,
-                                                 NULL,
-                                                 NULL,
-                                                 0,
+            error = ModuleList::GetSharedModule (module_spec,
                                                  exe_module_sp,
+                                                 module_search_paths_ptr,
                                                  NULL,
                                                  NULL);
 
@@ -191,12 +191,9 @@
             ArchSpec platform_arch;
             for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
             {
-                error = ModuleList::GetSharedModule (resolved_exe_file,
-                                                     platform_arch,
-                                                     NULL,
-                                                     NULL,
-                                                     0,
+                error = ModuleList::GetSharedModule (module_spec,
                                                      exe_module_sp,
+                                                     module_search_paths_ptr,
                                                      NULL,
                                                      NULL);
                 // Did we find an executable using one of the
@@ -466,7 +463,7 @@
             // The freebsd always currently uses the GDB remote debugger plug-in
             // so even when debugging locally we are debugging remotely!
             // Just like the darwin plugin.
-            process_sp = target->CreateProcess (listener, "gdb-remote");
+            process_sp = target->CreateProcess (listener, "gdb-remote", NULL);
 
             if (process_sp)
                 error = process_sp->Attach (attach_info);
@@ -526,12 +523,9 @@
 }
 
 Error
-PlatformFreeBSD::GetSharedModule (const FileSpec &platform_file,
-                                  const ArchSpec &arch,
-                                  const UUID *uuid_ptr,
-                                  const ConstString *object_name_ptr,
-                                  off_t object_offset,
+PlatformFreeBSD::GetSharedModule (const ModuleSpec &module_spec,
                                   ModuleSP &module_sp,
+                                  const FileSpecList *module_search_paths_ptr,
                                   ModuleSP *old_module_sp_ptr,
                                   bool *did_create_ptr)
 {
@@ -544,12 +538,9 @@
         // the shared module first.
         if (m_remote_platform_sp)
         {
-            error = m_remote_platform_sp->GetSharedModule (platform_file,
-                                                           arch,
-                                                           uuid_ptr,
-                                                           object_name_ptr,
-                                                           object_offset,
+            error = m_remote_platform_sp->GetSharedModule (module_spec,
                                                            module_sp,
+                                                           module_search_paths_ptr,
                                                            old_module_sp_ptr,
                                                            did_create_ptr);
         }
@@ -558,17 +549,14 @@
     if (!module_sp)
     {
         // Fall back to the local platform and find the file locally
-        error = Platform::GetSharedModule (platform_file,
-                                           arch,
-                                           uuid_ptr,
-                                           object_name_ptr,
-                                           object_offset,
+        error = Platform::GetSharedModule (module_spec,
                                            module_sp,
+                                           module_search_paths_ptr,
                                            old_module_sp_ptr,
                                            did_create_ptr);
     }
     if (module_sp)
-        module_sp->SetPlatformFileSpec(platform_file);
+        module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
     return error;
 }
 

Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h?rev=151532&r1=151531&r2=151532&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Mon Feb 27 12:40:48 2012
@@ -83,7 +83,8 @@
     virtual lldb_private::Error
     ResolveExecutable (const lldb_private::FileSpec &exe_file,
                        const lldb_private::ArchSpec &arch,
-                       lldb::ModuleSP &module_sp);
+                       lldb::ModuleSP &module_sp,
+                       const lldb_private::FileSpecList *module_search_paths_ptr);
 
     virtual size_t
     GetSoftwareBreakpointTrapOpcode (lldb_private::Target &target,
@@ -148,12 +149,9 @@
              const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file);
 
     lldb_private::Error
-    GetSharedModule (const lldb_private::FileSpec &platform_file,
-                     const lldb_private::ArchSpec &arch,
-                     const lldb_private::UUID *uuid_ptr,
-                     const lldb_private::ConstString *object_name_ptr,
-                     off_t object_offset,
+    GetSharedModule (const lldb_private::ModuleSpec &module_spec,
                      lldb::ModuleSP &module_sp,
+                     const lldb_private::FileSpecList *module_search_paths_ptr,
                      lldb::ModuleSP *old_module_sp_ptr,
                      bool *did_create_ptr);
 

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=151532&r1=151531&r2=151532&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Mon Feb 27 12:40:48 2012
@@ -31,10 +31,15 @@
 //------------------------------------------------------------------------------
 // Static functions.
 
-Process*
-ProcessFreeBSD::CreateInstance(Target& target, Listener &listener)
-{
-    return new ProcessFreeBSD(target, listener);
+lldb::ProcessSP
+ProcessFreeBSD::CreateInstance(Target& target,
+                               Listener &listener,
+                               const FileSpec *crash_file_path)
+{
+    lldb::ProcessSP process_sp;
+    if (crash_file_path == NULL)
+        process_sp.reset(new ProcessFreeBSD (target, listener));
+    return process_sp;
 }
 
 void

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h?rev=151532&r1=151531&r2=151532&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h Mon Feb 27 12:40:48 2012
@@ -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);

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=151532&r1=151531&r2=151532&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Mon Feb 27 12:40:48 2012
@@ -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.





More information about the lldb-commits mailing list