diff options
author | Jason Molenda <jmolenda@apple.com> | 2012-05-03 22:37:30 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2012-05-03 22:37:30 +0000 |
commit | 16d127cb7bb31e0c38b296ac977280353e6e5c14 (patch) | |
tree | 228ad3770579272cc38f2d4d06e259c28f8d4165 | |
parent | 356782f5f6dafe135e252a676ffb3f64e734ace6 (diff) | |
download | bcm5719-llvm-16d127cb7bb31e0c38b296ac977280353e6e5c14.tar.gz bcm5719-llvm-16d127cb7bb31e0c38b296ac977280353e6e5c14.zip |
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>
llvm-svn: 156116
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 22 |
2 files changed, 25 insertions, 5 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index ffb165d279c..5b59289bb9a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -457,6 +457,14 @@ ProcessGDBRemote::DoConnectRemote (const char *remote_url) 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; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 2a02bd52d17..deb657c2664 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2741,11 +2741,23 @@ Process::CompleteAttach () 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 |