[Lldb-commits] [lldb] r155862 - in /lldb/branches/lldb-platform-work: include/lldb/Target/Process.h source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h source/Utility/StringExtractorGDBRemote.cpp source/Utility/StringExtractorGDBRemote.h test/macosx/universal/TestUniversal.py
Enrico Granata
egranata at apple.com
Mon Apr 30 16:47:09 PDT 2012
Author: enrico
Date: Mon Apr 30 18:47:08 2012
New Revision: 155862
URL: http://llvm.org/viewvc/llvm-project?rev=155862&view=rev
Log:
Enabling the QLaunchArch: GDB remote packet, which allows the client to ask for a specific architecture inside the executable to be used to spawn a process.
Modified:
lldb/branches/lldb-platform-work/include/lldb/Target/Process.h
lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp
lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h
lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Process.h?rev=155862&r1=155861&r2=155862&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Process.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Process.h Mon Apr 30 18:47:08 2012
@@ -231,6 +231,12 @@
return m_arch;
}
+ void
+ SetArchitecture (ArchSpec arch)
+ {
+ m_arch = arch;
+ }
+
lldb::pid_t
GetProcessID () const
{
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=155862&r1=155861&r2=155862&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Mon Apr 30 18:47:08 2012
@@ -244,14 +244,14 @@
bool *did_create_ptr)
{
- printf("[%s] Trying to find module %s/%s - platform path %s/%s symbol path %s/%s\n",
+ /*printf("[%s] Trying to find module %s/%s - platform path %s/%s symbol path %s/%s\n",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
module_spec.GetFileSpec().GetFilename().AsCString(),
module_spec.GetPlatformFileSpec().GetDirectory().AsCString(),
module_spec.GetPlatformFileSpec().GetFilename().AsCString(),
module_spec.GetSymbolFileSpec().GetDirectory().AsCString(),
- module_spec.GetSymbolFileSpec().GetFilename().AsCString());
+ module_spec.GetSymbolFileSpec().GetFilename().AsCString());*/
std::string cache_path(GetLocalCacheDirectory());
std::string module_path;
@@ -268,10 +268,10 @@
return err;
if (module_cache_spec.Exists())
{
- printf("[%s] module %s/%s was rsynced and is now there\n",
+ /*printf("[%s] module %s/%s was rsynced and is now there\n",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
- module_spec.GetFileSpec().GetFilename().AsCString());
+ module_spec.GetFileSpec().GetFilename().AsCString());*/
ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
module_sp.reset(new Module(local_spec));
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
@@ -298,10 +298,10 @@
if (low_local != low_remote || high_local != high_remote)
{
// bring in the remote file
- printf("[%s] module %s/%s needs to be replaced from remote copy\n",
+ /*printf("[%s] module %s/%s needs to be replaced from remote copy\n",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
- module_spec.GetFileSpec().GetFilename().AsCString());
+ module_spec.GetFileSpec().GetFilename().AsCString());*/
Error err = BringInRemoteFile (this, module_spec, module_cache_spec);
if (err.Fail())
return err;
@@ -311,27 +311,27 @@
ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
module_sp.reset(new Module(local_spec));
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
- printf("[%s] module %s/%s was found in the cache\n",
+ /*printf("[%s] module %s/%s was found in the cache\n",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
- module_spec.GetFileSpec().GetFilename().AsCString());
+ module_spec.GetFileSpec().GetFilename().AsCString());*/
return Error();
}
// bring in the remote module file
- printf("[%s] module %s/%s needs to come in remotely\n",
+ /*printf("[%s] module %s/%s needs to come in remotely\n",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
- module_spec.GetFileSpec().GetFilename().AsCString());
+ module_spec.GetFileSpec().GetFilename().AsCString());*/
Error err = BringInRemoteFile (this, module_spec, module_cache_spec);
if (err.Fail())
return err;
if (module_cache_spec.Exists())
{
- printf("[%s] module %s/%s is now cached and fine\n",
+ /*printf("[%s] module %s/%s is now cached and fine\n",
(IsHost() ? "host" : "remote"),
module_spec.GetFileSpec().GetDirectory().AsCString(),
- module_spec.GetFileSpec().GetFilename().AsCString());
+ module_spec.GetFileSpec().GetFilename().AsCString());*/
ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
module_sp.reset(new Module(local_spec));
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
Modified: lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=155862&r1=155861&r2=155862&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Mon Apr 30 18:47:08 2012
@@ -322,6 +322,12 @@
break;
}
}
+
+ ArchSpec arch_spec = launch_info.GetArchitecture();
+ const char *arch_triple = arch_spec.GetTriple().str().c_str();
+
+ m_gdb_client.SendLaunchArchPacket(arch_triple);
+
const uint32_t old_packet_timeout = m_gdb_client.SetPacketTimeout (5);
int arg_packet_err = m_gdb_client.SendArgumentsPacket (argv);
m_gdb_client.SetPacketTimeout (old_packet_timeout);
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=155862&r1=155861&r2=155862&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Mon Apr 30 18:47:08 2012
@@ -143,6 +143,9 @@
case StringExtractorGDBRemote::eServerPacketType_QEnvironment:
return Handle_QEnvironment (packet);
+
+ case StringExtractorGDBRemote::eServerPacketType_QLaunchArch:
+ return Handle_QLaunchArch (packet);
case StringExtractorGDBRemote::eServerPacketType_QSetDisableASLR:
return Handle_QSetDisableASLR (packet);
@@ -784,6 +787,21 @@
}
bool
+GDBRemoteCommunicationServer::Handle_QLaunchArch (StringExtractorGDBRemote &packet)
+{
+ packet.SetFilePos(::strlen ("QLaunchArch:"));
+ const uint32_t bytes_left = packet.GetBytesLeft();
+ if (bytes_left > 0)
+ {
+ const char* arch_triple = packet.Peek();
+ ArchSpec arch_spec(arch_triple,NULL);
+ m_process_launch_info.SetArchitecture(arch_spec);
+ return SendOKResponse();
+ }
+ return SendErrorResponse(9);
+}
+
+bool
GDBRemoteCommunicationServer::Handle_QSetDisableASLR (StringExtractorGDBRemote &packet)
{
packet.SetFilePos(::strlen ("QSetDisableASLR:"));
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h?rev=155862&r1=155861&r2=155862&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h Mon Apr 30 18:47:08 2012
@@ -123,6 +123,9 @@
Handle_QEnvironment (StringExtractorGDBRemote &packet);
bool
+ Handle_QLaunchArch (StringExtractorGDBRemote &packet);
+
+ bool
Handle_QSetDisableASLR (StringExtractorGDBRemote &packet);
bool
Modified: lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp?rev=155862&r1=155861&r2=155862&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.cpp Mon Apr 30 18:47:08 2012
@@ -94,6 +94,9 @@
else if (PACKET_STARTS_WITH ("QSetSTDERR:")) return eServerPacketType_QSetSTDERR;
else if (PACKET_STARTS_WITH ("QSetWorkingDir:")) return eServerPacketType_QSetWorkingDir;
break;
+ case 'L':
+ if (PACKET_STARTS_WITH ("QLaunchArch:")) return eServerPacketType_QLaunchArch;
+ break;
}
break;
Modified: lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h?rev=155862&r1=155861&r2=155862&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h (original)
+++ lldb/branches/lldb-platform-work/source/Utility/StringExtractorGDBRemote.h Mon Apr 30 18:47:08 2012
@@ -58,6 +58,7 @@
eServerPacketType_qSpeedTest,
eServerPacketType_qUserName,
eServerPacketType_QEnvironment,
+ eServerPacketType_QLaunchArch,
eServerPacketType_QSetDisableASLR,
eServerPacketType_QSetSTDIN,
eServerPacketType_QSetSTDOUT,
Modified: lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py?rev=155862&r1=155861&r2=155862&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py (original)
+++ lldb/branches/lldb-platform-work/test/macosx/universal/TestUniversal.py Mon Apr 30 18:47:08 2012
@@ -34,8 +34,6 @@
process = target.LaunchSimple(None, None, os.getcwd())
self.assertTrue(process, PROCESS_IS_VALID)
- # rdar://problem/11310502
- @unittest2.expectedFailure
@unittest2.skipUnless(sys.platform.startswith("darwin") and os.uname()[4] in ['i386', 'x86_64'],
"requires Darwin & i386")
def test_process_launch_for_universal(self):
@@ -96,7 +94,6 @@
self.assertTrue(target and process,
"32-bit process launched")
- # rdar://problem/11310502
pointerSize = self.invoke(process, 'GetAddressByteSize')
self.assertTrue(pointerSize == 4,
"AddressByteSize of 32-bit process should be 4, got %d instead." % pointerSize)
More information about the lldb-commits
mailing list