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`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108953/new/

https://reviews.llvm.org/D108953

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to