mirror of
https://github.com/intel/llvm.git
synced 2026-01-15 12:25:46 +08:00
[lldb] Add ScriptedPlatform python implementation
This patch introduces both the Scripted Platform python base implementation and an example for it. The base implementation is embedded in lldb python module under `lldb.plugins.scripted_platform`. This patch also refactor the various SWIG methods to create scripted objects into a single method, that is now shared between the Scripted Platform, Process and Thread. It also replaces the target argument by a execution context object. Differential Revision: https://reviews.llvm.org/D139250 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
@@ -7,8 +7,8 @@ from lldb.plugins.scripted_process import ScriptedProcess
|
||||
from lldb.plugins.scripted_process import ScriptedThread
|
||||
|
||||
class DummyScriptedProcess(ScriptedProcess):
|
||||
def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData):
|
||||
super().__init__(target, args)
|
||||
def __init__(self, exe_ctx: lldb.SBExecutionContext, args : lldb.SBStructuredData):
|
||||
super().__init__(exe_ctx, args)
|
||||
self.threads[0] = DummyScriptedThread(self, None)
|
||||
|
||||
def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryRegionInfo:
|
||||
|
||||
@@ -7,8 +7,8 @@ from lldb.plugins.scripted_process import ScriptedProcess
|
||||
from lldb.plugins.scripted_process import ScriptedThread
|
||||
|
||||
class InvalidScriptedProcess(ScriptedProcess):
|
||||
def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData):
|
||||
super().__init__(target, args)
|
||||
def __init__(self, exe_ctx: lldb.SBExecutionContext, args : lldb.SBStructuredData):
|
||||
super().__init__(exe_ctx, args)
|
||||
self.threads[0] = InvalidScriptedThread(self, None)
|
||||
|
||||
def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryRegionInfo:
|
||||
|
||||
@@ -13,8 +13,8 @@ class StackCoreScriptedProcess(ScriptedProcess):
|
||||
return module
|
||||
return None
|
||||
|
||||
def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData):
|
||||
super().__init__(target, args)
|
||||
def __init__(self, exe_ctx: lldb.SBExecutionContext, args : lldb.SBStructuredData):
|
||||
super().__init__(exe_ctx, args)
|
||||
|
||||
self.corefile_target = None
|
||||
self.corefile_process = None
|
||||
@@ -25,7 +25,7 @@ class StackCoreScriptedProcess(ScriptedProcess):
|
||||
idx = self.backing_target_idx.GetIntegerValue(42)
|
||||
if self.backing_target_idx.GetType() == lldb.eStructuredDataTypeString:
|
||||
idx = int(self.backing_target_idx.GetStringValue(100))
|
||||
self.corefile_target = target.GetDebugger().GetTargetAtIndex(idx)
|
||||
self.corefile_target = self.target.GetDebugger().GetTargetAtIndex(idx)
|
||||
self.corefile_process = self.corefile_target.GetProcess()
|
||||
for corefile_thread in self.corefile_process:
|
||||
structured_data = lldb.SBStructuredData()
|
||||
|
||||
Reference in New Issue
Block a user