llvm-project/lldb/bindings/interface
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
..
SBAddress.i [lldb][docs] Resolve the remaining sphinx formatter warnings in the SB API docs 2021-01-18 10:47:19 +01:00
SBAttachInfo.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBBlock.i [lldb] Clarify docstring for SBBlock::IsInlined, NFC 2020-09-17 16:54:58 -07:00
SBBreakpoint.i [lldb] Use internal_dict name over dict in python examples 2021-02-10 15:11:00 -08:00
SBBreakpointLocation.i [lldb] Use internal_dict name over dict in python examples 2021-02-10 15:11:00 -08:00
SBBreakpointName.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBBroadcaster.i [lldb][docs] Resolve the remaining sphinx formatter warnings in the SB API docs 2021-01-18 10:47:19 +01:00
SBCommandInterpreter.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBCommandInterpreterRunOptions.i [lldb/API] Add CommandInterpreter::{Get,Set}PrintErrors to SBAPI (NFC) 2021-03-05 19:33:33 +01:00
SBCommandReturnObject.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBCommunication.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBCompileUnit.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBData.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBDebugger.i [lldb][docs] Resolve the remaining sphinx formatter warnings in the SB API docs 2021-01-18 10:47:19 +01:00
SBDeclaration.i
SBEnvironment.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBError.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBEvent.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBExecutionContext.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBExpressionOptions.i [lldb] NFC: Fix trivial typo in comments, documents, and messages 2020-04-07 01:06:16 +09:00
SBFile.i [lldb][docs] Use inline literals for code/paths instead of rendering it with the default role 2021-01-18 11:10:19 +01:00
SBFileSpec.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBFileSpecList.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBFrame.i [lldb][docs] Use inline literals for code/paths instead of rendering it with the default role 2021-01-18 11:10:19 +01:00
SBFunction.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBHostOS.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBInstruction.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBInstructionList.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBLanguageRuntime.i [lldb][docs] Add a doc page for enums and constants 2021-01-19 18:54:05 +01:00
SBLaunchInfo.i [lldb/Commands] Add command options for ScriptedProcess to ProcessLaunch 2021-03-23 18:24:47 +01:00
SBLineEntry.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBListener.i [lldb] Fix two documentation typos 2021-01-19 15:25:15 +01:00
SBMemoryRegionInfo.i [lldb/Plugins] Add memory region support in ScriptedProcess 2021-10-08 14:54:07 +02:00
SBMemoryRegionInfoList.i [lldb/Plugins] Add memory region support in ScriptedProcess 2021-10-08 14:54:07 +02:00
SBModule.i [lldb][docs] Resolve the remaining sphinx formatter warnings in the SB API docs 2021-01-18 10:47:19 +01:00
SBModuleSpec.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBPlatform.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBProcess.i [lldb] Add AllocateMemory/DeallocateMemory to the SBProcess API 2021-07-16 00:45:22 +02:00
SBProcessInfo.i Revert "[LLDB/API] Expose args and env from SBProcessInfo." 2021-06-05 15:50:49 +07:00
SBQueue.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBQueueItem.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBReproducer.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBSection.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBSourceManager.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBStream.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBStringList.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBStructuredData.i [trace][intel-pt] Create basic SB API 2021-06-17 15:14:47 -07:00
SBSymbol.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBSymbolContext.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBSymbolContextList.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBTarget.i [trace][intel-pt] Create basic SB API 2021-06-17 15:14:47 -07:00
SBThread.i [lldb] [gdb-remote server] Introduce new stop reasons for fork and vfork 2021-04-24 11:08:33 +02:00
SBThreadCollection.i
SBThreadPlan.i [lldb] [gdb-remote server] Introduce new stop reasons for fork and vfork 2021-04-24 11:08:33 +02:00
SBTrace.i [trace][intel-pt] Create basic SB API 2021-06-17 15:14:47 -07:00
SBType.i [lldb][docs] Document SBType 2021-06-14 13:19:19 +02:00
SBTypeCategory.i
SBTypeEnumMember.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBTypeFilter.i
SBTypeFormat.i
SBTypeNameSpecifier.i
SBTypeSummary.i
SBTypeSynthetic.i
SBUnixSignals.i
SBValue.i [lldb][docs] Use inline literals for code/paths instead of rendering it with the default role 2021-01-18 11:10:19 +01:00
SBValueList.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00
SBVariablesOptions.i [lldb][docs] Cleanup the Python doc strings for SB API classes 2021-01-17 16:51:07 +01:00
SBWatchpoint.i [lldb][docs] Translate ASCII art to restructured text formatting 2021-01-15 14:43:27 +01:00