This patch makes ScriptedThreadPlan conforming to the ScriptedInterface
& ScriptedPythonInterface facilities by introducing 2
ScriptedThreadPlanInterface & ScriptedThreadPlanPythonInterface classes.
This allows us to get rid of every ScriptedThreadPlan-specific SWIG
method and re-use the same affordances as other scripting offordances,
like Scripted{Process,Thread,Platform} & OperatingSystem.
To do so, this adds new transformer methods for `ThreadPlan`, `Stream` &
`Event`, to allow the bijection between C++ objects and their python
counterparts.
This just re-lands #70392 after fixing test failures.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
This commit is contained in:
1 parent
335e00faaf
commit
4cc6d0f4df
25 files changed
+468
-431
No files matched your search
+19
-9
@@ -7,6 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "lldb/Host/Config.h"
|
||||
#include "lldb/Target/ExecutionContext.h"
|
||||
#include "lldb/Utility/Log.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
|
||||
@@ -44,7 +45,8 @@ lldb::tid_t ScriptedThreadPythonInterface::GetThreadID() {
|
||||
Status error;
|
||||
StructuredData::ObjectSP obj = Dispatch("get_thread_id", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
|
||||
error))
|
||||
return LLDB_INVALID_THREAD_ID;
|
||||
|
||||
return obj->GetUnsignedIntegerValue(LLDB_INVALID_THREAD_ID);
|
||||
@@ -54,7 +56,8 @@ std::optional<std::string> ScriptedThreadPythonInterface::GetName() {
|
||||
Status error;
|
||||
StructuredData::ObjectSP obj = Dispatch("get_name", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
|
||||
error))
|
||||
return {};
|
||||
|
||||
return obj->GetStringValue().str();
|
||||
@@ -64,7 +67,8 @@ lldb::StateType ScriptedThreadPythonInterface::GetState() {
|
||||
Status error;
|
||||
StructuredData::ObjectSP obj = Dispatch("get_state", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
|
||||
error))
|
||||
return eStateInvalid;
|
||||
|
||||
return static_cast<StateType>(obj->GetUnsignedIntegerValue(eStateInvalid));
|
||||
@@ -74,7 +78,8 @@ std::optional<std::string> ScriptedThreadPythonInterface::GetQueue() {
|
||||
Status error;
|
||||
StructuredData::ObjectSP obj = Dispatch("get_queue", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
|
||||
error))
|
||||
return {};
|
||||
|
||||
return obj->GetStringValue().str();
|
||||
@@ -85,7 +90,8 @@ StructuredData::DictionarySP ScriptedThreadPythonInterface::GetStopReason() {
|
||||
StructuredData::DictionarySP dict =
|
||||
Dispatch<StructuredData::DictionarySP>("get_stop_reason", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, dict, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, dict,
|
||||
error))
|
||||
return {};
|
||||
|
||||
return dict;
|
||||
@@ -96,7 +102,8 @@ StructuredData::ArraySP ScriptedThreadPythonInterface::GetStackFrames() {
|
||||
StructuredData::ArraySP arr =
|
||||
Dispatch<StructuredData::ArraySP>("get_stackframes", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, arr, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, arr,
|
||||
error))
|
||||
return {};
|
||||
|
||||
return arr;
|
||||
@@ -107,7 +114,8 @@ StructuredData::DictionarySP ScriptedThreadPythonInterface::GetRegisterInfo() {
|
||||
StructuredData::DictionarySP dict =
|
||||
Dispatch<StructuredData::DictionarySP>("get_register_info", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, dict, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, dict,
|
||||
error))
|
||||
return {};
|
||||
|
||||
return dict;
|
||||
@@ -117,7 +125,8 @@ std::optional<std::string> ScriptedThreadPythonInterface::GetRegisterContext() {
|
||||
Status error;
|
||||
StructuredData::ObjectSP obj = Dispatch("get_register_context", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
|
||||
error))
|
||||
return {};
|
||||
|
||||
return obj->GetAsString()->GetValue().str();
|
||||
@@ -128,7 +137,8 @@ StructuredData::ArraySP ScriptedThreadPythonInterface::GetExtendedInfo() {
|
||||
StructuredData::ArraySP arr =
|
||||
Dispatch<StructuredData::ArraySP>("get_extended_info", error);
|
||||
|
||||
if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, arr, error))
|
||||
if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, arr,
|
||||
error))
|
||||
return {};
|
||||
|
||||
return arr;
|
||||
|
||||
Reference in new issue
Block a user