88 lines · c
1//===-- OperatingSystemPython.h ---------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef liblldb_OperatingSystemPython_h_10#define liblldb_OperatingSystemPython_h_11 12#include "lldb/Host/Config.h"13 14#if LLDB_ENABLE_PYTHON15 16#include "lldb/Target/DynamicRegisterInfo.h"17#include "lldb/Target/OperatingSystem.h"18#include "lldb/Utility/StructuredData.h"19 20namespace lldb_private {21class ScriptInterpreter;22}23 24class OperatingSystemPython : public lldb_private::OperatingSystem {25public:26 OperatingSystemPython(lldb_private::Process *process,27 const lldb_private::FileSpec &python_module_path);28 29 ~OperatingSystemPython() override;30 31 // Static Functions32 static lldb_private::OperatingSystem *33 CreateInstance(lldb_private::Process *process, bool force);34 35 static void Initialize();36 37 static void Terminate();38 39 static llvm::StringRef GetPluginNameStatic() { return "python"; }40 41 static llvm::StringRef GetPluginDescriptionStatic();42 43 // lldb_private::PluginInterface Methods44 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }45 46 // lldb_private::OperatingSystem Methods47 bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,48 lldb_private::ThreadList &real_thread_list,49 lldb_private::ThreadList &new_thread_list) override;50 51 void ThreadWasSelected(lldb_private::Thread *thread) override;52 53 lldb::RegisterContextSP54 CreateRegisterContextForThread(lldb_private::Thread *thread,55 lldb::addr_t reg_data_addr) override;56 57 lldb::StopInfoSP58 CreateThreadStopReason(lldb_private::Thread *thread) override;59 60 // Method for lazy creation of threads on demand61 lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;62 63 bool DoesPluginReportAllThreads() override;64 65protected:66 bool IsValid() const {67 return m_script_object_sp && m_script_object_sp->IsValid();68 }69 70 lldb::ThreadSP CreateThreadFromThreadInfo(71 lldb_private::StructuredData::Dictionary &thread_dict,72 lldb_private::ThreadList &core_thread_list,73 lldb_private::ThreadList &old_thread_list,74 std::vector<bool> &core_used_map, bool *did_create_ptr);75 76 lldb_private::DynamicRegisterInfo *GetDynamicRegisterInfo();77 78 lldb::ValueObjectSP m_thread_list_valobj_sp;79 std::unique_ptr<lldb_private::DynamicRegisterInfo> m_register_info_up;80 lldb_private::ScriptInterpreter *m_interpreter = nullptr;81 lldb::OperatingSystemInterfaceSP m_operating_system_interface_sp = nullptr;82 lldb_private::StructuredData::GenericSP m_script_object_sp = nullptr;83};84 85#endif // LLDB_ENABLE_PYTHON86 87#endif // liblldb_OperatingSystemPython_h_88