[Lldb-commits] [PATCH] D108953: [lldb/Plugins] Add memory region support in ScriptedProcess

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 9 09:15:59 PDT 2021

mib added a comment.

Following @JDevlieghere question in https://reviews.llvm.org/D107585#2979988, here are some explanations:

In order to read memory from the ScriptedProcess, the process plugin calls the python `read_memory_at_address` method passing the address at which we should start reading (and the number of bytes to be read).

However, the memory buffer, that provided by the python_script, - usually - starts at offset 0. This is why having memory regions in the python script allows up to:

1. Check that the address that should be read is in one of the our memory regions.
2. Shift the address by the region start address so the memory reads are done at the right location.

Using a SB class for Scripted Processes could be risky, since it can introduce a cyclic dependency: If, for instance, we use a facility that is itself backed by an execution context object (process, thread, frame) for one of the Scripted execution context objects, that will cause the C++ object to use a Python object which will again use a C++ object, and so on.

Luckily, this is not an issue for `lldb.SBMemoryRegionInfo`.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list