[Lldb-commits] [lldb] r156116 - in /lldb/trunk/source: Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Target/Process.cpp

Jason Molenda jmolenda at apple.com
Thu May 3 15:37:31 PDT 2012


Author: jmolenda
Date: Thu May  3 17:37:30 2012
New Revision: 156116

URL: http://llvm.org/viewvc/llvm-project?rev=156116&view=rev
Log:
In ProcessGDBRemote::DoConnectRemote(), if the remote system informed
us of its architecture, use that to set the Target's arch if it
doesn't already have one set.

In Process::CompleteAttach(), if the Target has a valid arch make
sure that the Platform we pick up is compatible with that arch; if
not, find a Platform that is compatible.  Don't let the the default
platform override the Target's arch.

<rdar://problem/11185420>

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=156116&r1=156115&r2=156116&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu May  3 17:37:30 2012
@@ -457,6 +457,14 @@
         else
             error.SetErrorStringWithFormat ("Process %llu was reported after connecting to '%s', but no stop reply packet was received", pid, remote_url);
     }
+
+    if (error.Success() 
+        && !GetTarget().GetArchitecture().IsValid()
+        && m_gdb_comm.GetHostArchitecture().IsValid())
+    {
+        GetTarget().SetArchitecture(m_gdb_comm.GetHostArchitecture());
+    }
+
     return error;
 }
 

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=156116&r1=156115&r2=156116&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu May  3 17:37:30 2012
@@ -2741,11 +2741,23 @@
     assert (platform_sp.get());
     if (platform_sp)
     {
-        ProcessInstanceInfo process_info;
-        platform_sp->GetProcessInfo (GetID(), process_info);
-        const ArchSpec &process_arch = process_info.GetArchitecture();
-        if (process_arch.IsValid() && m_target.GetArchitecture() != process_arch)
-            m_target.SetArchitecture (process_arch);
+	  const ArchSpec &target_arch = m_target.GetArchitecture();
+	  if (target_arch.IsValid() && !platform_sp->IsCompatibleWithArchitecture (target_arch))
+	  {
+              platform_sp = platform_sp->GetPlatformForArchitecture (target_arch);
+              if (platform_sp)
+              {
+                  m_target.SetPlatform (platform_sp);
+              }
+	  }
+	  else
+	  {
+      	         ProcessInstanceInfo process_info;
+	         platform_sp->GetProcessInfo (GetID(), process_info);
+	         const ArchSpec &process_arch = process_info.GetArchitecture();
+	         if (process_arch.IsValid() && m_target.GetArchitecture() != process_arch)
+	             m_target.SetArchitecture (process_arch);
+	  }
     }
 
     // We have completed the attach, now it is time to find the dynamic loader





More information about the lldb-commits mailing list