[Lldb-commits] [lldb] r217779 - Properly decode architecture type in GDBRemoteCommunicationClient::GetCurrentProcessInfo.
Todd Fiala
todd.fiala at gmail.com
Mon Sep 15 09:01:30 PDT 2014
Author: tfiala
Date: Mon Sep 15 11:01:29 2014
New Revision: 217779
URL: http://llvm.org/viewvc/llvm-project?rev=217779&view=rev
Log:
Properly decode architecture type in GDBRemoteCommunicationClient::GetCurrentProcessInfo.
Instead of forcing the remote arch type to MachO all the time, we
inspect the OS/vendor that the remote debug server reports and use it to
set the arch type to MachO, ELF or COFF accordingly.
See thread here for more context:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140915/012968.html
Change by Stephane Sezer.
Tested:
MacOSX 10.9.4 x86_64
Ubuntu 14.04 x86_64
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=217779&r1=217778&r2=217779&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Mon Sep 15 11:01:29 2014
@@ -2404,6 +2404,8 @@ GDBRemoteCommunicationClient::GetProcess
bool
GDBRemoteCommunicationClient::GetCurrentProcessInfo ()
{
+ Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS));
+
if (m_qProcessInfo_is_valid == eLazyBoolYes)
return true;
if (m_qProcessInfo_is_valid == eLazyBoolNo)
@@ -2502,7 +2504,25 @@ GDBRemoteCommunicationClient::GetCurrent
}
else if (cpu != LLDB_INVALID_CPUTYPE && !os_name.empty() && !vendor_name.empty())
{
- m_process_arch.SetArchitecture (eArchTypeMachO, cpu, sub);
+ llvm::Triple triple(llvm::Twine("-") + vendor_name + "-" + os_name);
+
+ assert(triple.getObjectFormat() != llvm::Triple::UnknownObjectFormat);
+ switch (triple.getObjectFormat()) {
+ case llvm::Triple::MachO:
+ m_process_arch.SetArchitecture (eArchTypeMachO, cpu, sub);
+ break;
+ case llvm::Triple::ELF:
+ m_process_arch.SetArchitecture (eArchTypeELF, cpu, sub);
+ break;
+ case llvm::Triple::COFF:
+ m_process_arch.SetArchitecture (eArchTypeCOFF, cpu, sub);
+ break;
+ case llvm::Triple::UnknownObjectFormat:
+ if (log)
+ log->Printf("error: failed to determine target architecture");
+ return false;
+ }
+
if (pointer_byte_size)
{
assert (pointer_byte_size == m_process_arch.GetAddressByteSize());
More information about the lldb-commits
mailing list