Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 1 | //===-- ThreadPlanPython.h --------------------------------------------*- C++ |
| 2 | //-*-===// |
| 3 | // |
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 10 | #ifndef LLDB_TARGET_THREADPLANPYTHON_H |
| 11 | #define LLDB_TARGET_THREADPLANPYTHON_H |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 12 | |
| 13 | #include <string> |
| 14 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 15 | #include "lldb/lldb-forward.h" |
| 16 | |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 17 | #include "lldb/Target/Process.h" |
| 18 | #include "lldb/Target/StopInfo.h" |
| 19 | #include "lldb/Target/Target.h" |
| 20 | #include "lldb/Target/Thread.h" |
| 21 | #include "lldb/Target/ThreadPlan.h" |
| 22 | #include "lldb/Target/ThreadPlanTracer.h" |
| 23 | #include "lldb/Utility/StructuredData.h" |
| 24 | #include "lldb/Utility/UserID.h" |
| 25 | #include "lldb/lldb-private.h" |
| 26 | |
| 27 | namespace lldb_private { |
| 28 | |
| 29 | // ThreadPlanPython: |
| 30 | // |
| 31 | |
| 32 | class ThreadPlanPython : public ThreadPlan { |
| 33 | public: |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 34 | ThreadPlanPython(Thread &thread, const char *class_name, |
| 35 | StructuredDataImpl *args_data); |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 36 | ~ThreadPlanPython() override; |
| 37 | |
| 38 | void GetDescription(Stream *s, lldb::DescriptionLevel level) override; |
| 39 | |
| 40 | bool ValidatePlan(Stream *error) override; |
| 41 | |
| 42 | bool ShouldStop(Event *event_ptr) override; |
| 43 | |
| 44 | bool MischiefManaged() override; |
| 45 | |
| 46 | bool WillStop() override; |
| 47 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 48 | bool StopOthers() override { return m_stop_others; } |
| 49 | |
| 50 | void SetStopOthers(bool new_value) override { m_stop_others = new_value; } |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 51 | |
| 52 | void DidPush() override; |
| 53 | |
| 54 | bool IsPlanStale() override; |
| 55 | |
| 56 | protected: |
| 57 | bool DoPlanExplainsStop(Event *event_ptr) override; |
| 58 | |
| 59 | lldb::StateType GetPlanRunState() override; |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 60 | |
| 61 | ScriptInterpreter *GetScriptInterpreter(); |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 62 | |
| 63 | private: |
| 64 | std::string m_class_name; |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 65 | StructuredDataImpl *m_args_data; // We own this, but the implementation |
| 66 | // has to manage the UP (since that is |
| 67 | // how it gets stored in the |
| 68 | // SBStructuredData). |
| 69 | std::string m_error_str; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 70 | StructuredData::ObjectSP m_implementation_sp; |
| 71 | bool m_did_push; |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 72 | bool m_stop_others; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 73 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 74 | ThreadPlanPython(const ThreadPlanPython &) = delete; |
| 75 | const ThreadPlanPython &operator=(const ThreadPlanPython &) = delete; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | } // namespace lldb_private |
| 79 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame^] | 80 | #endif // LLDB_TARGET_THREADPLANPYTHON_H |