10SN/A//===-- OperatingSystemPython.h ---------------------------------*- C++ -*-===//
22362SN/A//
30SN/A// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40SN/A// See https://llvm.org/LICENSE.txt for license information.
50SN/A// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60SN/A//
72362SN/A//===----------------------------------------------------------------------===//
80SN/A
92362SN/A#ifndef liblldb_OperatingSystemPython_h_
100SN/A#define liblldb_OperatingSystemPython_h_
110SN/A
120SN/A#include "lldb/Host/Config.h"
130SN/A
140SN/A#if LLDB_ENABLE_PYTHON
150SN/A
160SN/A#include "lldb/Target/OperatingSystem.h"
170SN/A#include "lldb/Utility/StructuredData.h"
180SN/A
190SN/Aclass DynamicRegisterInfo;
200SN/A
212362SN/Anamespace lldb_private {
222362SN/Aclass ScriptInterpreter;
232362SN/A}
240SN/A
250SN/Aclass OperatingSystemPython : public lldb_private::OperatingSystem {
260SN/Apublic:
270SN/A  OperatingSystemPython(lldb_private::Process *process,
280SN/A                        const lldb_private::FileSpec &python_module_path);
290SN/A
300SN/A  ~OperatingSystemPython() override;
310SN/A
320SN/A  // Static Functions
330SN/A  static lldb_private::OperatingSystem *
340SN/A  CreateInstance(lldb_private::Process *process, bool force);
350SN/A
360SN/A  static void Initialize();
370SN/A
380SN/A  static void Terminate();
390SN/A
400SN/A  static lldb_private::ConstString GetPluginNameStatic();
410SN/A
420SN/A  static const char *GetPluginDescriptionStatic();
430SN/A
440SN/A  // lldb_private::PluginInterface Methods
450SN/A  lldb_private::ConstString GetPluginName() override;
460SN/A
470SN/A  uint32_t GetPluginVersion() override;
480SN/A
490SN/A  // lldb_private::OperatingSystem Methods
500SN/A  bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,
510SN/A                        lldb_private::ThreadList &real_thread_list,
520SN/A                        lldb_private::ThreadList &new_thread_list) override;
530SN/A
540SN/A  void ThreadWasSelected(lldb_private::Thread *thread) override;
550SN/A
560SN/A  lldb::RegisterContextSP
570SN/A  CreateRegisterContextForThread(lldb_private::Thread *thread,
580SN/A                                 lldb::addr_t reg_data_addr) override;
590SN/A
600SN/A  lldb::StopInfoSP
610SN/A  CreateThreadStopReason(lldb_private::Thread *thread) override;
620SN/A
630SN/A  // Method for lazy creation of threads on demand
640SN/A  lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;
650SN/A
660SN/Aprotected:
670SN/A  bool IsValid() const {
680SN/A    return m_python_object_sp && m_python_object_sp->IsValid();
690SN/A  }
700SN/A
710SN/A  lldb::ThreadSP CreateThreadFromThreadInfo(
720SN/A      lldb_private::StructuredData::Dictionary &thread_dict,
730SN/A      lldb_private::ThreadList &core_thread_list,
740SN/A      lldb_private::ThreadList &old_thread_list,
750SN/A      std::vector<bool> &core_used_map, bool *did_create_ptr);
760SN/A
770SN/A  DynamicRegisterInfo *GetDynamicRegisterInfo();
780SN/A
790SN/A  lldb::ValueObjectSP m_thread_list_valobj_sp;
800SN/A  std::unique_ptr<DynamicRegisterInfo> m_register_info_up;
810SN/A  lldb_private::ScriptInterpreter *m_interpreter;
820SN/A  lldb_private::StructuredData::ObjectSP m_python_object_sp;
830SN/A};
840SN/A
850SN/A#endif
860SN/A
870SN/A#endif // liblldb_OperatingSystemPython_h_
880SN/A