[lldb/Plugins] Add ability to load modules to Scripted Processes

This patch introduces a new way to load modules programatically with
Scripted Processes. To do so, the scripted process blueprint holds a
list of dictionary describing the modules to load, which their path or
uuid, load address and eventually a slide offset.

LLDB will fetch that list after launching the ScriptedProcess, and
iterate over each entry to create the module that will be loaded in the
Scripted Process' target.

The patch also refactors the StackCoreScriptedProcess test to stop
inside the `libbaz` module and make sure it's loaded correctly and that
we can fetch some variables from it.

rdar://74520238

Differential Revision: https://reviews.llvm.org/D120969

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2022-03-04 11:22:32 -08:00
parent 6eddd987c9
commit 680ca7f21a
12 changed files with 189 additions and 29 deletions

View File

@@ -19,7 +19,7 @@ class ScriptedProcess:
memory_regions = None
stack_memory_dump = None
loaded_images = None
threads = {}
threads = None
@abstractmethod
def __init__(self, target, args):
@@ -41,6 +41,8 @@ class ScriptedProcess:
self.dbg = target.GetDebugger()
if isinstance(args, lldb.SBStructuredData) and args.IsValid():
self.args = args
self.threads = {}
self.loaded_images = []
@abstractmethod
def get_memory_region_containing_address(self, addr):
@@ -116,8 +118,7 @@ class ScriptedProcess:
```
class ScriptedProcessImage:
def __init__(name, file_spec, uuid, load_address):
self.name = name
def __init__(file_spec, uuid, load_address):
self.file_spec = file_spec
self.uuid = uuid
self.load_address = load_address