Made lldb_private::ArchSpec contain much more than just an architecture. It
now, in addition to cpu type/subtype and architecture flavor, contains:
- byte order (big endian, little endian)
- address size in bytes
- llvm::Triple for true target triple support and for more powerful plug-in
selection.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125602 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
index 26841dc..5318014 100644
--- a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
+++ b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
@@ -443,39 +443,10 @@
Module * exe_module = GetTarget().GetExecutableModule ().get();
assert (exe_module);
- m_arch_spec = exe_module->GetArchitecture();
- assert (m_arch_spec.IsValid());
-
- ObjectFile *exe_objfile = exe_module->GetObjectFile();
- assert (exe_objfile);
-
- m_byte_order = exe_objfile->GetByteOrder();
- assert (m_byte_order != eByteOrderInvalid);
// Install a signal handler so we can catch when our child process
// dies and set the exit status correctly.
m_monitor_thread = Host::StartMonitoringChildProcess (Process::SetProcessExitStatus, NULL, GetID(), false);
-
- if (m_arch_spec == ArchSpec("arm"))
- {
- // On ARM we want the actual target triple of the OS to get the
- // most capable ARM slice for the process. Since this plug-in is
- // only used for doing native debugging this will work.
- m_target_triple = Host::GetTargetTriple();
- }
- else
- {
- // We want the arch of the process, and the vendor and OS from the
- // host OS.
- StreamString triple;
-
- triple.Printf("%s-%s-%s",
- m_arch_spec.AsCString(),
- Host::GetVendorString().AsCString("apple"),
- Host::GetOSString().AsCString("darwin"));
-
- m_target_triple.SetCString(triple.GetString().c_str());
- }
}
}
@@ -883,12 +854,6 @@
return error;
}
-ByteOrder
-ProcessMacOSX::GetByteOrder () const
-{
- return m_byte_order;
-}
-
//------------------------------------------------------------------
// Process Queries
//------------------------------------------------------------------
diff --git a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
index c3df2f3..c0a80c5 100644
--- a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
+++ b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
@@ -222,9 +222,6 @@
virtual lldb_private::Error
DisableWatchpoint (lldb_private::WatchpointLocation *wp_loc);
- virtual lldb::ByteOrder
- GetByteOrder () const;
-
virtual lldb_private::DynamicLoader *
GetDynamicLoader ();
diff --git a/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp b/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
index 7a91903..ac1623e 100644
--- a/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
+++ b/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
@@ -107,7 +107,9 @@
uint8_t memory_buffer[8];
addr_t dispatch_queue_offsets_addr = LLDB_INVALID_ADDRESS;
- DataExtractor data(memory_buffer, sizeof(memory_buffer), m_process.GetByteOrder(), m_process.GetAddressByteSize());
+ DataExtractor data (memory_buffer, sizeof(memory_buffer),
+ m_process.GetTarget().GetArchitecture().GetByteOrder(),
+ m_process.GetTarget().GetArchitecture().GetAddressByteSize());
static ConstString g_dispatch_queue_offsets_symbol_name ("dispatch_queue_offsets");
const Symbol *dispatch_queue_offsets_symbol = NULL;
ModuleSP module_sp(m_process.GetTarget().GetImages().FindFirstModuleForFileSpec (FileSpec("libSystem.B.dylib", false)));
@@ -477,6 +479,8 @@
case eStateStepping:
Resume();
break;
+ default:
+ break;
}
m_context->ThreadWillResume();
}
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 9ebb143..1f14a6e 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
// Other libraries and framework includes
+#include "llvm/ADT/Triple.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Log.h"
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index cee2d3d..cba0ca1 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -638,7 +638,7 @@
BuildDynamicRegisterInfo (false);
- m_byte_order = m_gdb_comm.GetByteOrder();
+ m_target.GetArchitecture().SetByteOrder (m_gdb_comm.GetByteOrder());
StreamString strm;
@@ -656,33 +656,16 @@
// defacto architecture in this case.
if (gdb_remote_arch == ArchSpec ("arm") &&
- vendor != NULL &&
- strcmp(vendor, "apple") == 0)
+ vendor && ::strcmp(vendor, "apple") == 0)
{
GetTarget().SetArchitecture (gdb_remote_arch);
target_arch = gdb_remote_arch;
}
- 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", target_arch.AsCString(), vendor, os_type);
-
- std::transform (strm.GetString().begin(),
- strm.GetString().end(),
- strm.GetString().begin(),
- ::tolower);
-
- m_target_triple.SetCString(strm.GetString().c_str());
- }
+ if (vendor)
+ m_target.GetArchitecture().GetTriple().setVendorName(vendor);
+ if (os_type)
+ m_target.GetArchitecture().GetTriple().setOSName(os_type);
}
}
@@ -2557,7 +2540,10 @@
}
uint8_t memory_buffer[8];
- DataExtractor data(memory_buffer, sizeof(memory_buffer), GetByteOrder(), GetAddressByteSize());
+ DataExtractor data (memory_buffer,
+ sizeof(memory_buffer),
+ m_target.GetArchitecture().GetByteOrder(),
+ m_target.GetArchitecture().GetAddressByteSize());
// Excerpt from src/queue_private.h
struct dispatch_queue_offsets_s