llvm-project/lldb/unittests
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] Handle missing SBStructuredData copy assignment cases 2021-05-05 15:12:03 -07:00
Breakpoint [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
Core [lldb][NFC] Remove unused method RichManglingContext::IsFunction 2021-08-23 11:45:55 -07:00
DataFormatter [nfc] [lldb] Prevent needless copies of DataExtractor 2021-08-04 20:35:53 +02:00
Disassembler [lldb/Plugins] Rename lldbPluginDisassemblerLLVM (NFC) 2020-02-17 19:14:01 -08:00
Editline Migrate to llvm::unique_function instead of static member functions for callbacks 2021-03-02 16:13:54 -08:00
Expression [lldb] Remove PluginInterface::GetPluginVersion 2021-09-13 10:29:00 +02:00
Host [lldb] [test] Use secondary pty end for testing Terminal 2021-10-08 14:42:47 +02:00
Instruction Fix UB in EmulateInstructionARM64.cpp 2020-06-01 18:11:50 -07:00
Interpreter Fix virtual-dtor warning a different way, since a virtual dtor is not required for this use case. 2021-03-01 09:25:26 -08:00
Language [lldb] Refactor and rename CPlusPlusLanguage::FindAlternateFunctionManglings 2021-09-16 13:13:07 -07:00
ObjectFile [lldb/ObjectFileMachO] Fetch shared cache images from our own shared cache 2020-07-16 10:37:37 -07:00
Platform Factor out common code from the iPhone/AppleTV/WatchOS simulator platform plugins. (NFC) 2020-08-06 16:36:58 -07:00
Process [lldb] Move DynamicRegisterInfo to public Target library 2021-10-05 12:40:55 +02:00
ScriptInterpreter [lldb/Plugins] Add memory region support in ScriptedProcess 2021-10-08 14:54:07 +02:00
Signals [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
Symbol [NFC] [Clang] Remove pre-computed complex float types 2021-10-08 15:52:16 +08:00
SymbolFile Recognize the Swift compiler in DW_AT_producer 2021-10-07 13:54:28 -07:00
Target Recommit: [lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo 2021-10-07 11:15:00 +02:00
TestingSupport [lldb] [llgs] Support owning and detaching extra processes 2021-04-24 11:08:33 +02:00
Thread [lldb] Remove PluginInterface::GetPluginVersion 2021-09-13 10:29:00 +02:00
UnwindAssembly Bug where insn-based unwind plans on arm64 could be wrong 2020-04-14 16:57:25 -07:00
Utility [lldb] Add support for escaping zsh arguments 2021-06-21 19:46:55 +02:00
debugserver [lldb] Convert misc. StringConvert uses 2021-09-25 14:19:19 +02:00
tools Recommit: [lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo 2021-10-07 11:15:00 +02:00
CMakeLists.txt Re-land "[lldb] Make the API, Shell and Unit tests independent lit test suites" 2021-03-22 14:36:43 -07:00
gtest_common.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00