diff options
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
4 files changed, 17 insertions, 19 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index 365d499..33092209 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -201,6 +201,7 @@ template <> struct PythonFormat<short> : PassthroughFormat<short, 'h'> {}; template <> struct PythonFormat<unsigned short> : PassthroughFormat<unsigned short, 'H'> {}; template <> struct PythonFormat<int> : PassthroughFormat<int, 'i'> {}; +template <> struct PythonFormat<bool> : PassthroughFormat<bool, 'p'> {}; template <> struct PythonFormat<unsigned int> : PassthroughFormat<unsigned int, 'I'> {}; template <> struct PythonFormat<long> : PassthroughFormat<long, 'l'> {}; diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp index cffa3bd..0c6f308 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp @@ -80,21 +80,8 @@ Status ScriptedProcessPythonInterface::Launch() { } Status ScriptedProcessPythonInterface::Resume() { - return GetStatusFromMethod("resume"); -} - -bool ScriptedProcessPythonInterface::ShouldStop() { - Status error; - StructuredData::ObjectSP obj = Dispatch("is_alive", error); - - if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error)) - return {}; - - return obj->GetBooleanValue(); -} - -Status ScriptedProcessPythonInterface::Stop() { - return GetStatusFromMethod("stop"); + // When calling ScriptedProcess.Resume from lldb we should always stop. + return GetStatusFromMethod("resume", /*should_stop=*/true); } std::optional<MemoryRegionInfo> diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h index b7b12b9..d1fedfe 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h @@ -37,10 +37,6 @@ public: Status Resume() override; - bool ShouldStop() override; - - Status Stop() override; - std::optional<MemoryRegionInfo> GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error) override; diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h index a015bd1..31757a2 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h @@ -113,6 +113,11 @@ protected: return {object}; } + python::PythonObject Transform(bool arg) { + // Boolean arguments need to be turned into python objects. + return python::PythonBoolean(arg); + } + python::PythonObject Transform(Status arg) { return python::ToSWIGWrapper(arg); } @@ -141,6 +146,15 @@ protected: original_arg = ExtractValueFromPythonObject<T>(transformed_arg, error); } + template <> + void ReverseTransform(bool &original_arg, + python::PythonObject transformed_arg, Status &error) { + python::PythonBoolean boolean_arg = python::PythonBoolean( + python::PyRefType::Borrowed, transformed_arg.get()); + if (boolean_arg.IsValid()) + original_arg = boolean_arg.GetValue(); + } + template <std::size_t... I, typename... Args> auto TransformTuple(const std::tuple<Args...> &args, std::index_sequence<I...>) { |
