This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by mib on Mar 3 2022, 9:09 PM.

Details

Summary

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Mar 3 2022, 9:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2022, 9:09 PM
mib requested review of this revision.Mar 3 2022, 9:09 PM
mib updated this revision to Diff 412923.Mar 3 2022, 9:11 PM

Re-format

JDevlieghere added inline comments.Mar 4 2022, 10:37 AM
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
413–416

Nit: you're calling it a key in the first error message, but field in the second. Let's pick one and be consistent.

lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
51

What exactly is this value? Shouldn't we get the load address from the core file and report that?

mib added inline comments.Mar 4 2022, 11:02 AM
lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
51

You're right, I missed that.

mib updated this revision to Diff 413079.Mar 4 2022, 11:22 AM
mib marked 2 inline comments as done.

Address @JDevlieghere comments:

  • Fix error message
  • Use corefile module load address for scripted process module
This revision is now accepted and ready to land.Mar 4 2022, 11:26 AM