This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Plugins] Add memory writing capabilities to Scripted Process
ClosedPublic

Authored by mib on Feb 16 2023, 5:10 PM.

Details

Summary

This patch adds memory writing capabilities to the Scripted Process plugin.

This allows to user to get a target address and a memory buffer on the
python scripted process implementation that the user can make processing
on before performing the actual write.

This will also be used to write trap instruction to a real process
memory to set a breakpoint.

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

Diff Detail

Event Timeline

mib created this revision.Feb 16 2023, 5:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 5:10 PM
mib requested review of this revision.Feb 16 2023, 5:10 PM
mib updated this revision to Diff 498205.Feb 16 2023, 5:27 PM

Reformat

mib updated this revision to Diff 498206.Feb 16 2023, 5:29 PM
mib updated this revision to Diff 498207.Feb 16 2023, 5:31 PM

Fix typo

bulbazord added inline comments.Feb 16 2023, 5:33 PM
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
334–335

This function is added in this patch. Where is it used?

349

Should this not return bytes_written?

mib marked an inline comment as done.Feb 16 2023, 5:37 PM
mib added inline comments.
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
334–335

Plugin::DoX functions are usually implemented by plugins and gets called by the base component Base::X method. In this case, this will get called by the Process::WriteMemory method.

349

+1

mib updated this revision to Diff 498211.Feb 16 2023, 5:45 PM
mib marked an inline comment as done.

Address @bulbazord comments.

This revision is now accepted and ready to land.Feb 17 2023, 10:36 AM
mib updated this revision to Diff 502319.Mar 3 2023, 5:17 PM

Rebase