[Lldb-commits] [PATCH] D13288: Restrict the scope of a hack in DYLDRendezvous
Tamas Berghammer via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 1 07:01:58 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL249012: Restrict the scope of a hack in DYLDRendezvous (authored by tberghammer).
Changed prior to commit:
http://reviews.llvm.org/D13288?vs=36097&id=36240#toc
Repository:
rL LLVM
http://reviews.llvm.org/D13288
Files:
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
===================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
@@ -76,7 +76,10 @@
uint32_t
GetSdkVersion();
-
+
+ bool
+ GetRemoteOSVersion() override;
+
Error
DisconnectRemote () override;
Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
===================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -362,3 +362,12 @@
// Download the symbolfile from the remote device
return GetFile(symfile_platform_filespec, dst_file_spec);
}
+
+bool
+PlatformAndroid::GetRemoteOSVersion ()
+{
+ m_major_os_version = GetSdkVersion();
+ m_minor_os_version = 0;
+ m_update_os_version = 0;
+ return m_major_os_version != 0;
+}
Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
===================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -17,6 +17,7 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -372,6 +373,25 @@
return str;
}
+// Returns true if the load bias reported by the linker is incorrect for the given entry. This
+// function is used to handle cases where we want to work around a bug in the system linker.
+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;
+ if (target.GetArchitecture().GetTriple().getEnvironment() == llvm::Triple::Android &&
+ 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"))
+ {
+ return true;
+ }
+
+ return false;
+}
+
bool
DYLDRendezvous::ReadSOEntryFromMemory(lldb::addr_t addr, SOEntry &entry)
{
@@ -413,11 +433,9 @@
std::string file_path = ReadStringFromMemory(entry.path_addr);
entry.file_spec.SetFile(file_path, false);
- // On Android L (5.0, 5.1) the load address of the "/system/bin/linker" isn't filled in
- // correctly. To get the correct load address we fetch the load address of the file from the
- // proc file system.
- if (arch.GetTriple().getEnvironment() == llvm::Triple::Android && entry.base_addr == 0 &&
- (file_path == "/system/bin/linker" || file_path == "/system/bin/linker64"))
+ // If the load bias reported by the linker is incorrect then fetch the load address of the file
+ // from the proc file system.
+ if (isLoadBiasIncorrect(m_process->GetTarget(), file_path))
{
lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
bool is_loaded = false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13288.36240.patch
Type: text/x-patch
Size: 3361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151001/66fe183f/attachment.bin>
More information about the lldb-commits
mailing list