[lldb] Add a way to get a scripted process implementation from the SBAPI

This patch introduces a new `GetScriptedImplementation` method to the
SBProcess class in the SBAPI. It will allow users of Scripted Processes to
fetch the scripted implementation object from to script interpreter to be
able to interact with it directly (without having to go through lldb).

This allows to user to perform action that are not specified in the
scripted process interface, like calling un-specified methods, but also
to enrich the implementation, by passing it complex objects.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2023-02-03 12:28:47 -08:00
parent a48c4a45e0
commit c192803304
11 changed files with 64 additions and 0 deletions

View File

@@ -512,3 +512,10 @@ void ScriptedProcess::UpdateQueueListIfNeeded() {
ScriptedProcessInterface &ScriptedProcess::GetInterface() const {
return m_interpreter->GetScriptedProcessInterface();
}
void *ScriptedProcess::GetImplementation() {
if (m_script_object_sp &&
m_script_object_sp->GetType() == eStructuredDataTypeGeneric)
return m_script_object_sp->GetAsGeneric()->GetValue();
return nullptr;
}