Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
39638 views
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-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef liblldb_OperatingSystemPython_h_
10
#define liblldb_OperatingSystemPython_h_
11
12
#include "lldb/Host/Config.h"
13
14
#if LLDB_ENABLE_PYTHON
15
16
#include "lldb/Target/DynamicRegisterInfo.h"
17
#include "lldb/Target/OperatingSystem.h"
18
#include "lldb/Utility/StructuredData.h"
19
20
namespace lldb_private {
21
class ScriptInterpreter;
22
}
23
24
class OperatingSystemPython : public lldb_private::OperatingSystem {
25
public:
26
OperatingSystemPython(lldb_private::Process *process,
27
const lldb_private::FileSpec &python_module_path);
28
29
~OperatingSystemPython() override;
30
31
// Static Functions
32
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 Methods
44
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
45
46
// lldb_private::OperatingSystem Methods
47
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::RegisterContextSP
54
CreateRegisterContextForThread(lldb_private::Thread *thread,
55
lldb::addr_t reg_data_addr) override;
56
57
lldb::StopInfoSP
58
CreateThreadStopReason(lldb_private::Thread *thread) override;
59
60
// Method for lazy creation of threads on demand
61
lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;
62
63
protected:
64
bool IsValid() const {
65
return m_script_object_sp && m_script_object_sp->IsValid();
66
}
67
68
lldb::ThreadSP CreateThreadFromThreadInfo(
69
lldb_private::StructuredData::Dictionary &thread_dict,
70
lldb_private::ThreadList &core_thread_list,
71
lldb_private::ThreadList &old_thread_list,
72
std::vector<bool> &core_used_map, bool *did_create_ptr);
73
74
lldb_private::DynamicRegisterInfo *GetDynamicRegisterInfo();
75
76
lldb::ValueObjectSP m_thread_list_valobj_sp;
77
std::unique_ptr<lldb_private::DynamicRegisterInfo> m_register_info_up;
78
lldb_private::ScriptInterpreter *m_interpreter = nullptr;
79
lldb::OperatingSystemInterfaceSP m_operating_system_interface_sp = nullptr;
80
lldb_private::StructuredData::GenericSP m_script_object_sp = nullptr;
81
};
82
83
#endif // LLDB_ENABLE_PYTHON
84
85
#endif // liblldb_OperatingSystemPython_h_
86
87