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
17 // Other libraries and framework includes
19 #include "lldb/Core/StructuredData.h"
20 #include "lldb/Target/OperatingSystem.h"
22 class DynamicRegisterInfo;
24 namespace lldb_private {
25 class ScriptInterpreter;
28 class OperatingSystemPython : public lldb_private::OperatingSystem {
30 OperatingSystemPython(lldb_private::Process *process,
31 const lldb_private::FileSpec &python_module_path);
33 ~OperatingSystemPython() override;
35 //------------------------------------------------------------------
37 //------------------------------------------------------------------
38 static lldb_private::OperatingSystem *
39 CreateInstance(lldb_private::Process *process, bool force);
41 static void Initialize();
43 static void Terminate();
45 static lldb_private::ConstString GetPluginNameStatic();
47 static const char *GetPluginDescriptionStatic();
49 //------------------------------------------------------------------
50 // lldb_private::PluginInterface Methods
51 //------------------------------------------------------------------
52 lldb_private::ConstString GetPluginName() override;
54 uint32_t GetPluginVersion() override;
56 //------------------------------------------------------------------
57 // lldb_private::OperatingSystem Methods
58 //------------------------------------------------------------------
59 bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,
60 lldb_private::ThreadList &real_thread_list,
61 lldb_private::ThreadList &new_thread_list) override;
63 void ThreadWasSelected(lldb_private::Thread *thread) override;
65 lldb::RegisterContextSP
66 CreateRegisterContextForThread(lldb_private::Thread *thread,
67 lldb::addr_t reg_data_addr) override;
70 CreateThreadStopReason(lldb_private::Thread *thread) override;
72 //------------------------------------------------------------------
73 // Method for lazy creation of threads on demand
74 //------------------------------------------------------------------
75 lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;
78 bool IsValid() const {
79 return m_python_object_sp && m_python_object_sp->IsValid();
82 lldb::ThreadSP CreateThreadFromThreadInfo(
83 lldb_private::StructuredData::Dictionary &thread_dict,
84 lldb_private::ThreadList &core_thread_list,
85 lldb_private::ThreadList &old_thread_list,
86 std::vector<bool> &core_used_map, bool *did_create_ptr);
88 DynamicRegisterInfo *GetDynamicRegisterInfo();
90 lldb::ValueObjectSP m_thread_list_valobj_sp;
91 std::unique_ptr<DynamicRegisterInfo> m_register_info_ap;
92 lldb_private::ScriptInterpreter *m_interpreter;
93 lldb_private::StructuredData::ObjectSP m_python_object_sp;
96 #endif // LLDB_DISABLE_PYTHON
98 #endif // liblldb_OperatingSystemPython_h_