summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-03-23 00:09:55 +0000
committerGreg Clayton <gclayton@apple.com>2011-03-23 00:09:55 +0000
commitd314e810a70e9104c8d30d9b0719bc5a3dc0acab (patch)
tree0d881e5b16df61aa732dea1555adecf675db83e8 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent7ca3ddc2333a05f60be578cffc93610a34638602 (diff)
downloadbcm5719-llvm-d314e810a70e9104c8d30d9b0719bc5a3dc0acab.tar.gz
bcm5719-llvm-d314e810a70e9104c8d30d9b0719bc5a3dc0acab.zip
Added new platform commands:
platform connect <args> platform disconnect Each platform can decide the args they want to use for "platform connect". I will need to add a function that gets the connect options for the current platform as each one can have different options and argument counts. Hooked up more functionality in the PlatformMacOSX and PlatformRemoteiOS. Also started an platform agnostic PlatformRemoteGDBServer.cpp which can end up being used by one or more actual platforms. It can also be specialized and allow for platform specific commands. llvm-svn: 128123
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp62
1 files changed, 40 insertions, 22 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 79949669e77..e5a1d7c0606 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -622,34 +622,52 @@ ProcessGDBRemote::DidLaunchOrAttach ()
BuildDynamicRegisterInfo (false);
- m_target.GetArchitecture().SetByteOrder (m_gdb_comm.GetByteOrder());
StreamString strm;
// 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();
- ArchSpec target_arch (GetTarget().GetArchitecture());
- ArchSpec gdb_remote_arch (m_gdb_comm.GetHostArchitecture());
-
- // If the remote host is ARM and we 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.GetMachine() == llvm::Triple::arm &&
- gdb_remote_arch.GetTriple().getVendor() == llvm::Triple::Apple)
+
+ const ArchSpec &gdb_remote_arch = m_gdb_comm.GetHostArchitecture();
+ if (gdb_remote_arch.IsValid())
{
- GetTarget().SetArchitecture (gdb_remote_arch);
- target_arch = gdb_remote_arch;
+ ArchSpec &target_arch = GetTarget().GetArchitecture();
+
+ if (target_arch.IsValid())
+ {
+ // If the remote host is ARM and we 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.GetMachine() == llvm::Triple::arm &&
+ gdb_remote_arch.GetTriple().getVendor() == llvm::Triple::Apple)
+ {
+ target_arch = gdb_remote_arch;
+ }
+ else
+ {
+ // Fill in what is missing in the triple
+ const llvm::Triple &remote_triple = gdb_remote_arch.GetTriple();
+ llvm::Triple &target_triple = target_arch.GetTriple();
+ if (target_triple.getVendor() == llvm::Triple::UnknownVendor)
+ target_triple.setVendor (remote_triple.getVendor());
+
+ if (target_triple.getOS() == llvm::Triple::UnknownOS)
+ target_triple.setOS (remote_triple.getOS());
+
+ if (target_triple.getEnvironment() == llvm::Triple::UnknownEnvironment)
+ target_triple.setEnvironment (remote_triple.getEnvironment());
+ }
+ }
+ else
+ {
+ // The target doesn't have a valid architecture yet, set it from
+ // the architecture we got from the remote GDB server
+ target_arch = gdb_remote_arch;
+ }
}
-
- if (vendor)
- m_target.GetArchitecture().GetTriple().setVendorName(vendor);
- if (os_type)
- m_target.GetArchitecture().GetTriple().setOSName(os_type);
}
}
OpenPOWER on IntegriCloud