[Lldb-commits] [lldb] [LLDB][DYLD] Remove logic around not rebasing when main executable has a load address (PR #110885)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 2 11:28:57 PDT 2024


https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/110885

>From 5ed6e20b50f70754efbaa157720a7ef120bb6b1e Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Wed, 2 Oct 2024 09:50:26 -0700
Subject: [PATCH 1/2] Remove additional logic to disable the dynamic loader
 when the main executable already has a load address

---
 .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp         | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 51e4b3e6728f23..b9c0e174c3be68 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -108,21 +108,6 @@ void DynamicLoaderPOSIXDYLD::DidAttach() {
   // if we dont have a load address we cant re-base
   bool rebase_exec = load_offset != LLDB_INVALID_ADDRESS;
 
-  // if we have a valid executable
-  if (executable_sp.get()) {
-    lldb_private::ObjectFile *obj = executable_sp->GetObjectFile();
-    if (obj) {
-      // don't rebase if the module already has a load address
-      Target &target = m_process->GetTarget();
-      Address addr = obj->GetImageInfoAddress(&target);
-      if (addr.GetLoadAddress(&target) != LLDB_INVALID_ADDRESS)
-        rebase_exec = false;
-    }
-  } else {
-    // no executable, nothing to re-base
-    rebase_exec = false;
-  }
-
   // if the target executable should be re-based
   if (rebase_exec) {
     ModuleList module_list;

>From 071b7fac9f6eadf3c4c466146d429841f3ba1a86 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Wed, 2 Oct 2024 11:28:10 -0700
Subject: [PATCH 2/2] Change the test that emits an invalid .so

---
 .../functionalities/postmortem/minidump-new/TestMiniDumpUUID.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
index 2a3d291086b662..b212426802cc57 100644
--- a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
+++ b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
@@ -327,8 +327,6 @@ def test_relative_module_name(self):
         old_cwd = os.getcwd()
         self.addTearDownHook(lambda: os.chdir(old_cwd))
         os.chdir(self.getBuildDir())
-        name = "file-with-a-name-unlikely-to-exist-in-the-current-directory.so"
-        open(name, "a").close()
         modules = self.get_minidump_modules(
             self.getSourcePath("relative_module_name.yaml")
         )



More information about the lldb-commits mailing list