summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/DynamicLoader
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-06-18 15:02:23 +0000
committerPavel Labath <labath@google.com>2018-06-18 15:02:23 +0000
commit2272c4811f8d2c56612d483c2546f053e7ea61cc (patch)
treec591a7a541563c323f1b4f8697a8cd7b8ea53f8c /lldb/source/Plugins/DynamicLoader
parent13684d840019282ed720cd52a9a0e6c3485d3a76 (diff)
downloadbcm5719-llvm-2272c4811f8d2c56612d483c2546f053e7ea61cc.tar.gz
bcm5719-llvm-2272c4811f8d2c56612d483c2546f053e7ea61cc.zip
Use llvm::VersionTuple instead of manual version marshalling
Summary: This has multiple advantages: - we need only one function argument/instance variable instead of three - no need to default initialize variables - no custom parsing code - VersionTuple has comparison operators, which makes version comparisons much simpler Reviewers: zturner, friss, clayborg, jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D47889 llvm-svn: 334950
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader')
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp17
-rw-r--r--lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp3
2 files changed, 7 insertions, 13 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 96242fd958d..c35905bd71e 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -1122,34 +1122,29 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp,
bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
- uint32_t major, minor, update;
-
bool use_new_spi_interface = false;
- if (process->GetHostOSVersion(major, minor, update)) {
+ llvm::VersionTuple version = process->GetHostOSVersion();
+ if (!version.empty()) {
const llvm::Triple::OSType os_type =
process->GetTarget().GetArchitecture().GetTriple().getOS();
// macOS 10.12 and newer
if (os_type == llvm::Triple::MacOSX &&
- (major > 10 || (major == 10 && minor >= 12))) {
+ version >= llvm::VersionTuple(10, 12))
use_new_spi_interface = true;
- }
// iOS 10 and newer
- if (os_type == llvm::Triple::IOS && major >= 10) {
+ if (os_type == llvm::Triple::IOS && version >= llvm::VersionTuple(10))
use_new_spi_interface = true;
- }
// tvOS 10 and newer
- if (os_type == llvm::Triple::TvOS && major >= 10) {
+ if (os_type == llvm::Triple::TvOS && version >= llvm::VersionTuple(10))
use_new_spi_interface = true;
- }
// watchOS 3 and newer
- if (os_type == llvm::Triple::WatchOS && major >= 3) {
+ if (os_type == llvm::Triple::WatchOS && version >= llvm::VersionTuple(3))
use_new_spi_interface = true;
- }
}
if (log) {
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
index 68df4335c9e..b1513b51a90 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -454,9 +454,8 @@ std::string DYLDRendezvous::ReadStringFromMemory(addr_t addr) {
static bool isLoadBiasIncorrect(Target &target, const std::string &file_path) {
// On Android L (API 21, 22) the load address of the "/system/bin/linker"
// isn't filled in correctly.
- uint32_t os_major = 0, os_minor = 0, os_update = 0;
+ unsigned os_major = target.GetPlatform()->GetOSVersion().getMajor();
if (target.GetArchitecture().GetTriple().isAndroid() &&
- target.GetPlatform()->GetOSVersion(os_major, os_minor, os_update) &&
(os_major == 21 || os_major == 22) &&
(file_path == "/system/bin/linker" ||
file_path == "/system/bin/linker64")) {
OpenPOWER on IntegriCloud