Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Process/scripted/ScriptedThread.h
39644 views
1
//===-- ScriptedThread.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 LLDB_SOURCE_PLUGINS_SCRIPTED_THREAD_H
10
#define LLDB_SOURCE_PLUGINS_SCRIPTED_THREAD_H
11
12
#include <string>
13
14
#include "ScriptedProcess.h"
15
16
#include "Plugins/Process/Utility/RegisterContextMemory.h"
17
#include "lldb/Interpreter/ScriptInterpreter.h"
18
#include "lldb/Target//DynamicRegisterInfo.h"
19
#include "lldb/Target/Thread.h"
20
21
namespace lldb_private {
22
class ScriptedProcess;
23
}
24
25
namespace lldb_private {
26
27
class ScriptedThread : public lldb_private::Thread {
28
29
public:
30
ScriptedThread(ScriptedProcess &process,
31
lldb::ScriptedThreadInterfaceSP interface_sp, lldb::tid_t tid,
32
StructuredData::GenericSP script_object_sp = nullptr);
33
34
~ScriptedThread() override;
35
36
static llvm::Expected<std::shared_ptr<ScriptedThread>>
37
Create(ScriptedProcess &process,
38
StructuredData::Generic *script_object = nullptr);
39
40
lldb::RegisterContextSP GetRegisterContext() override;
41
42
lldb::RegisterContextSP
43
CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override;
44
45
bool LoadArtificialStackFrames();
46
47
bool CalculateStopInfo() override;
48
49
const char *GetInfo() override { return nullptr; }
50
51
const char *GetName() override;
52
53
const char *GetQueueName() override;
54
55
void WillResume(lldb::StateType resume_state) override;
56
57
void RefreshStateAfterStop() override;
58
59
void ClearStackFrames() override;
60
61
StructuredData::ObjectSP FetchThreadExtendedInfo() override;
62
63
private:
64
void CheckInterpreterAndScriptObject() const;
65
lldb::ScriptedThreadInterfaceSP GetInterface() const;
66
67
ScriptedThread(const ScriptedThread &) = delete;
68
const ScriptedThread &operator=(const ScriptedThread &) = delete;
69
70
std::shared_ptr<DynamicRegisterInfo> GetDynamicRegisterInfo();
71
72
const ScriptedProcess &m_scripted_process;
73
lldb::ScriptedThreadInterfaceSP m_scripted_thread_interface_sp = nullptr;
74
lldb_private::StructuredData::GenericSP m_script_object_sp = nullptr;
75
std::shared_ptr<DynamicRegisterInfo> m_register_info_sp = nullptr;
76
};
77
78
} // namespace lldb_private
79
80
#endif // LLDB_SOURCE_PLUGINS_SCRIPTED_THREAD_H
81
82