[Lldb-commits] [PATCH] D66858: POSIX DYLD: add workaround for android L loader

Saleem Abdulrasool via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 27 18:33:45 PDT 2019


compnerd created this revision.
compnerd added reviewers: davide, xiaobai.
Herald added subscribers: abidh, srhines.
Herald added a project: LLDB.

In certain cases, the loader does not report the base address of the DSO.
Attempt to infer it from the loaded address of the object file.  This was
originally added in the Swift fork of LLDB, this simply is upstreaming the
workaround for the system loader.  Unfortunately, without a recent test case, it
is difficult to construct a test case for this.  However, this problem is also
something which is worked around in the unwinder and has been seen multiple
times previously.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66858

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp


Index: source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
===================================================================
--- source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -550,6 +550,18 @@

   UpdateBaseAddrIfNecessary(entry, file_path);

+  // On Android L (5.0, 5.1) the base address for the lirbary is sometimes not
+  // reported.  Attempt to discover it based on the load address of the object
+  // file.
+  if (entry.base_addr == 0) {
+    lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
+    bool is_loaded = false;
+    Error error =
+        m_process->GetFileLoadAddress(entry.file_spec, is_loaded, load_addr);
+    if (error.Success() && is_loaded)
+      entry.base_addr = load_addr;
+  }
+
   return true;
 }



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66858.217560.patch
Type: text/x-patch
Size: 815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190828/f1855c18/attachment-0001.bin>


More information about the lldb-commits mailing list