summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-02-09 03:09:55 +0000
committerGreg Clayton <gclayton@apple.com>2011-02-09 03:09:55 +0000
commit0d0c12ab61ffab8e1e898d3fec397d110dc138ab (patch)
tree52cf0265b91e26cd00f050447d1a40526eda166c /lldb/source/Plugins/Process/gdb-remote
parent48b0b2f762ad915d49d0598b59ecd559dd278840 (diff)
downloadbcm5719-llvm-0d0c12ab61ffab8e1e898d3fec397d110dc138ab.tar.gz
bcm5719-llvm-0d0c12ab61ffab8e1e898d3fec397d110dc138ab.zip
<rdar://problem/8972204> Test failure: ./dotest.py -v -t -f UniversalTestCase.test_process_launch_for_universal
Fix for bad architecture settings that were being used from the qHostInfo. llvm-svn: 125161
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp64
1 files changed, 33 insertions, 31 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index fdf6d58818f..dd8de004ee3 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -648,46 +648,48 @@ ProcessGDBRemote::DidLaunchOrAttach ()
StreamString strm;
- ArchSpec inferior_arch (m_gdb_comm.GetHostArchitecture());
-
+ ;
// See if the GDB server supports the qHostInfo information
const char *vendor = m_gdb_comm.GetVendorString().AsCString();
const char *os_type = m_gdb_comm.GetOSString().AsCString();
- const ArchSpec target_arch (GetTarget().GetArchitecture());
- const ArchSpec arm_any("arm");
- bool set_target_arch = true;
- if (target_arch.IsValid())
+ ArchSpec target_arch (GetTarget().GetArchitecture());
+ ArchSpec gdb_remote_arch (m_gdb_comm.GetHostArchitecture());
+
+ // If the remote host is ARM and we are on have apple as the vendor, then
+ // ARM executables and shared libraries can have mixed ARM architectures.
+ // You can have an armv6 executable, and if the host is armv7, then the
+ // system will load the best possible architecture for all shared libraries
+ // it has, so we really need to take the remote host architecture as our
+ // defacto architecture in this case.
+
+ if (gdb_remote_arch == ArchSpec ("arm") &&
+ vendor != NULL &&
+ strcmp(vendor, "apple") == 0)
{
- if (inferior_arch == arm_any)
- {
- // For ARM we can't trust the arch of the process as it could
- // have an armv6 object file, but be running on armv7 kernel.
- // So we only set the ARM architecture if the target isn't set
- // to ARM already...
- if (target_arch == arm_any)
- {
- inferior_arch = target_arch;
- set_target_arch = false;
- }
- }
+ GetTarget().SetArchitecture (gdb_remote_arch);
+ target_arch = gdb_remote_arch;
}
- if (set_target_arch)
- GetTarget().SetArchitecture (inferior_arch);
-
- if (vendor == NULL)
- vendor = Host::GetVendorString().AsCString("apple");
- if (os_type == NULL)
- os_type = Host::GetOSString().AsCString("darwin");
+ if (!target_arch.IsValid())
+ target_arch = gdb_remote_arch;
+
+ if (target_arch.IsValid())
+ {
+ if (vendor == NULL)
+ vendor = Host::GetVendorString().AsCString("apple");
+
+ if (os_type == NULL)
+ os_type = Host::GetOSString().AsCString("darwin");
- strm.Printf ("%s-%s-%s", inferior_arch.AsCString(), vendor, os_type);
+ strm.Printf ("%s-%s-%s", target_arch.AsCString(), vendor, os_type);
- std::transform (strm.GetString().begin(),
- strm.GetString().end(),
- strm.GetString().begin(),
- ::tolower);
+ std::transform (strm.GetString().begin(),
+ strm.GetString().end(),
+ strm.GetString().begin(),
+ ::tolower);
- m_target_triple.SetCString(strm.GetString().c_str());
+ m_target_triple.SetCString(strm.GetString().c_str());
+ }
}
}
OpenPOWER on IntegriCloud