1 //===-- OperatingSystemPython.h ---------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_OperatingSystemPython_h_
11 #define liblldb_OperatingSystemPython_h_
13 #ifndef LLDB_DISABLE_PYTHON
15 #include "lldb/Target/OperatingSystem.h"
16 #include "lldb/Utility/StructuredData.h"
18 class DynamicRegisterInfo;
20 namespace lldb_private {
21 class ScriptInterpreter;
24 class OperatingSystemPython : public lldb_private::OperatingSystem {
26 OperatingSystemPython(lldb_private::Process *process,
27 const lldb_private::FileSpec &python_module_path);
29 ~OperatingSystemPython() override;
31 //------------------------------------------------------------------
33 //------------------------------------------------------------------
34 static lldb_private::OperatingSystem *
35 CreateInstance(lldb_private::Process *process, bool force);
37 static void Initialize();
39 static void Terminate();
41 static lldb_private::ConstString GetPluginNameStatic();
43 static const char *GetPluginDescriptionStatic();
45 //------------------------------------------------------------------
46 // lldb_private::PluginInterface Methods
47 //------------------------------------------------------------------
48 lldb_private::ConstString GetPluginName() override;
50 uint32_t GetPluginVersion() override;
52 //------------------------------------------------------------------
53 // lldb_private::OperatingSystem Methods
54 //------------------------------------------------------------------
55 bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,
56 lldb_private::ThreadList &real_thread_list,
57 lldb_private::ThreadList &new_thread_list) override;
59 void ThreadWasSelected(lldb_private::Thread *thread) override;
61 lldb::RegisterContextSP
62 CreateRegisterContextForThread(lldb_private::Thread *thread,
63 lldb::addr_t reg_data_addr) override;
66 CreateThreadStopReason(lldb_private::Thread *thread) override;
68 //------------------------------------------------------------------
69 // Method for lazy creation of threads on demand
70 //------------------------------------------------------------------
71 lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;
74 bool IsValid() const {
75 return m_python_object_sp && m_python_object_sp->IsValid();
78 lldb::ThreadSP CreateThreadFromThreadInfo(
79 lldb_private::StructuredData::Dictionary &thread_dict,
80 lldb_private::ThreadList &core_thread_list,
81 lldb_private::ThreadList &old_thread_list,
82 std::vector<bool> &core_used_map, bool *did_create_ptr);
84 DynamicRegisterInfo *GetDynamicRegisterInfo();
86 lldb::ValueObjectSP m_thread_list_valobj_sp;
87 std::unique_ptr<DynamicRegisterInfo> m_register_info_ap;
88 lldb_private::ScriptInterpreter *m_interpreter;
89 lldb_private::StructuredData::ObjectSP m_python_object_sp;
92 #endif // LLDB_DISABLE_PYTHON
94 #endif // liblldb_OperatingSystemPython_h_