[Lldb-commits] [lldb] r139679 - /lldb/trunk/source/Target/Process.cpp

Jim Ingham jingham at apple.com
Tue Sep 13 18:01:48 PDT 2011


Author: jingham
Date: Tue Sep 13 20:01:48 2011
New Revision: 139679

URL: http://llvm.org/viewvc/llvm-project?rev=139679&view=rev
Log:
If we haven't gotten the architecture of the process we're attaching
to by the time we get to the AttachCompletionHandler, do it before
completing the attach.

Modified:
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=139679&r1=139678&r2=139679&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Sep 13 20:01:48 2011
@@ -2167,6 +2167,25 @@
             // lldb_private::Process subclasses must set the process must set
             // the new process ID.
             assert (m_process->GetID() != LLDB_INVALID_PROCESS_ID);
+            // We just attached, if we haven't gotten a valid architecture at this point we should do so now.
+            Target &target = m_process->GetTarget();
+            if (!target.GetArchitecture().IsValid())
+            {
+                // FIXME: We shouldn't be getting the Selected Platform, there should
+                // be a platform for the target, and we should get that.
+                PlatformSP platform_sp (target.GetDebugger().GetPlatformList().GetSelectedPlatform ());
+                if (platform_sp)
+                {
+                    ProcessInstanceInfo process_info;
+                    platform_sp->GetProcessInfo (m_process->GetID(), process_info);
+                    const ArchSpec &process_arch = process_info.GetArchitecture();
+                    if (process_arch.IsValid())
+                    {
+                        // Set the architecture on the target.
+                        target.SetArchitecture (process_arch);
+                    }
+                }
+            }
             m_process->CompleteAttach ();
             return eEventActionSuccess;
         }





More information about the lldb-commits mailing list