summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
diff options
context:
space:
mode:
authorrchamala <36907958+rchamala@users.noreply.github.com>2025-02-23 00:51:43 -0800
committerGitHub <noreply@github.com>2025-02-23 00:51:43 -0800
commit2ff3b18554b115b17d5085b9a4cd779eeafd278a (patch)
tree0d1e2a464c7ce490a706420ebe77f4acb2656b15 /lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
parent0968df9c3a5562f6a8d9f7948065848f3a273b81 (diff)
Allow option to ignore module load errors in ScriptedProcess (#127153)
Current state in scripted process expects [all the modules](https://github.com/llvm/llvm-project/blob/912b154f3a3f8c3cebf5cc5731fd8b0749762da5/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp#L498) passed into "get_loaded_images" to load successfully else none of them load. Even if a module loads fine, [but has already been appended](https://github.com/llvm/llvm-project/blob/912b154f3a3f8c3cebf5cc5731fd8b0749762da5/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp#L495) it still fails. This is restrictive and does not help our usecase. **Usecase**: We have a parent scripted process using coredump + tombstone. 1) Scripted process uses child elf-core process to read memory dump 2) Uses tombstones to pass thread names and modules. We do not know whether the modules will be successfully downloaded before creating the scripted process. We use [python module callbacks](https://github.com/llvm/llvm-project/blob/a57e58dbfaae0e86eb5cafeddf8b598f14b96e36/lldb/source/Target/Platform.cpp#L1593) to download a module from symbol server at LLDB load time when the scripted process is being created. The issue is that if one of the symbol is not found from the list specified in tombstone, none of the modules load in scripted process. Even if we ensure symbols are present in symbol server before creating the scripted process, if the load address is wrong or if the module is already appended, all module loads are skipped. **Solution**: Pass in a custom boolean option arg for every module from python scripted process plugin which will indicate whether to ignore the module load error. This will provide the flexibility to user for loading the successfully fetched modules into target while ignoring the failed ones --------- Co-authored-by: rchamala <rachamal@fb.com>
Diffstat (limited to 'lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py')
-rw-r--r--lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
index a5c79378bab5..22b0d01c2c17 100644
--- a/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
@@ -76,6 +76,12 @@ class StackCoreScriptedProcesTestCase(TestBase):
)
self.assertTrue(corefile_process, PROCESS_IS_VALID)
+ # Create a random lib which does not exist in the corefile.
+ random_dylib = self.get_module_with_name(corefile_target, "random.dylib")
+ self.assertFalse(
+ random_dylib, "Dynamic library random.dylib should not be found."
+ )
+
structured_data = lldb.SBStructuredData()
structured_data.SetFromJSON(
json.dumps(
@@ -83,7 +89,15 @@ class StackCoreScriptedProcesTestCase(TestBase):
"backing_target_idx": self.dbg.GetIndexOfTarget(
corefile_process.GetTarget()
),
- "libbaz_path": self.getBuildArtifact("libbaz.dylib"),
+ "custom_modules": [
+ {
+ "path": self.getBuildArtifact("libbaz.dylib"),
+ },
+ {
+ "path": "/random/path/random.dylib",
+ "load_addr": 12345678,
+ },
+ ],
}
)
)