diff options
author | Med Ismail Bennani <medismail.bennani@gmail.com> | 2021-10-08 12:25:04 +0000 |
---|---|---|
committer | Med Ismail Bennani <medismail.bennani@gmail.com> | 2021-10-08 14:54:07 +0200 |
commit | a758c9f7204c41d8791e76d24f9bc4791534f1b8 (patch) | |
tree | 520683d8b67dc11a94ac9c09e4fb4c8c2a7e5a05 /lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp | |
parent | 59d8dd79e1f9dead2dc2756e139073083e487228 (diff) | |
download | llvm-a758c9f7204c41d8791e76d24f9bc4791534f1b8.zip llvm-a758c9f7204c41d8791e76d24f9bc4791534f1b8.tar.gz llvm-a758c9f7204c41d8791e76d24f9bc4791534f1b8.tar.bz2 |
[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>
Diffstat (limited to 'lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp')
-rw-r--r-- | lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp index e636b8c..ea6d6be 100644 --- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp +++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp @@ -166,6 +166,10 @@ extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data) { return nullptr; } +extern "C" void *LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(void *data) { + return nullptr; +} + extern lldb::ValueObjectSP LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data) { return nullptr; |