llvm-project/lldb/source
Med Ismail Bennani a758c9f720 [lldb/Plugins] Add memory region support in ScriptedProcess
This patch adds support for memory regions in Scripted Processes.
This is necessary to read the stack memory region in order to
reconstruct each stackframe of the program.

In order to do so, this patch makes some changes to the SBAPI, namely:
- Add a new constructor for `SBMemoryRegionInfo` that takes arguments
  such as the memory region name, address range, permissions ...
  This is used when reading memory at some address to compute the offset
  in the binary blob provided by the user.
- Add a `GetMemoryRegionContainingAddress` method to `SBMemoryRegionInfoList`
  to simplify the access to a specific memory region.

With these changes, lldb is now able to unwind the stack and reconstruct
each frame. On top of that, reloading the target module at offset 0 allows
lldb to symbolicate the `ScriptedProcess` using debug info, similarly to an
ordinary Process.

To test this, I wrote a simple program with multiple function calls, ran it in
lldb, stopped at a leaf function and read the registers values and copied
the stack memory into a binary file. These are then used in the python script.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-10-08 14:54:07 +02:00
..
API [lldb/Plugins] Add memory region support in ScriptedProcess 2021-10-08 14:54:07 +02:00
Breakpoint [lldb] Remove some anonymous namespaces 2021-10-05 08:35:18 +02:00
Commands [lldb] Improve help for platform put-file 2021-10-05 10:29:37 -07:00
Core [lldb] Remove shared_ptr from some global Properties objects 2021-10-08 10:43:37 +02:00
DataFormatters [nfc] [lldb] Prevent needless copies of DataExtractor 2021-08-04 20:35:53 +02:00
Expression [lldb, mlir] Migrate from getNumArgOperands and arg_operands (NFC) 2021-10-07 08:29:42 -07:00
Host [lldb] [ConnectionFileDescriptorPosix] Refactor scheme matching 2021-10-08 11:47:57 +02:00
Initialization [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
Interpreter [lldb/Plugins] Add memory region support in ScriptedProcess 2021-10-08 14:54:07 +02:00
Plugins [lldb/Plugins] Add memory region support in ScriptedProcess 2021-10-08 14:54:07 +02:00
Symbol [lldb] Convert misc. StringConvert uses 2021-09-25 14:19:19 +02:00
Target [lldb] Remove shared_ptr from some global Properties objects 2021-10-08 10:43:37 +02:00
Utility [lldb] [gdb-remote] Implement the vRun packet 2021-09-10 14:08:36 +02:00
CMakeLists.txt [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project 2021-09-16 18:29:57 +02:00
lldb.cpp [lldb] Reinstate support for LLDB_VERSION_STRING 2021-02-22 16:56:00 -08:00