Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:54

0001 //===-- ScriptedThreadPlan.h ------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_TARGET_SCRIPTEDTHREADPLAN_H
0010 #define LLDB_TARGET_SCRIPTEDTHREADPLAN_H
0011 
0012 #include <string>
0013 
0014 #include "lldb/Core/StructuredDataImpl.h"
0015 #include "lldb/Interpreter/Interfaces/ScriptedThreadPlanInterface.h"
0016 #include "lldb/Target/Process.h"
0017 #include "lldb/Target/StopInfo.h"
0018 #include "lldb/Target/Target.h"
0019 #include "lldb/Target/Thread.h"
0020 #include "lldb/Target/ThreadPlan.h"
0021 #include "lldb/Target/ThreadPlanTracer.h"
0022 #include "lldb/Utility/StructuredData.h"
0023 #include "lldb/Utility/UserID.h"
0024 #include "lldb/lldb-forward.h"
0025 #include "lldb/lldb-private.h"
0026 
0027 namespace lldb_private {
0028 
0029 class ScriptedThreadPlan : public ThreadPlan {
0030 public:
0031   ScriptedThreadPlan(Thread &thread, const char *class_name,
0032                      const StructuredDataImpl &args_data);
0033 
0034   void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
0035 
0036   bool ValidatePlan(Stream *error) override;
0037 
0038   bool ShouldStop(Event *event_ptr) override;
0039 
0040   bool MischiefManaged() override;
0041 
0042   bool WillStop() override;
0043 
0044   bool StopOthers() override { return m_stop_others; }
0045 
0046   void SetStopOthers(bool new_value) override { m_stop_others = new_value; }
0047 
0048   void DidPush() override;
0049 
0050   bool IsPlanStale() override;
0051 
0052   bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
0053 
0054 protected:
0055   bool DoPlanExplainsStop(Event *event_ptr) override;
0056 
0057   lldb::StateType GetPlanRunState() override;
0058 
0059   ScriptInterpreter *GetScriptInterpreter();
0060 
0061 private:
0062   std::string m_class_name;
0063   StructuredDataImpl m_args_data;
0064   std::string m_error_str;
0065   StructuredData::ObjectSP m_implementation_sp;
0066   StreamString m_stop_description; // Cache the stop description here
0067   bool m_did_push;
0068   bool m_stop_others;
0069   lldb::ScriptedThreadPlanInterfaceSP m_interface;
0070 
0071   ScriptedThreadPlan(const ScriptedThreadPlan &) = delete;
0072   const ScriptedThreadPlan &operator=(const ScriptedThreadPlan &) = delete;
0073 };
0074 
0075 } // namespace lldb_private
0076 
0077 #endif // LLDB_TARGET_SCRIPTEDTHREADPLAN_H