84 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_SCRIPTED_THREAD_H10#define LLDB_SOURCE_PLUGINS_SCRIPTED_THREAD_H11 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 21namespace lldb_private {22class ScriptedProcess;23class ScriptedFrame;24}25 26namespace lldb_private {27 28class ScriptedThread : public lldb_private::Thread {29 30public:31 ScriptedThread(ScriptedProcess &process,32 lldb::ScriptedThreadInterfaceSP interface_sp, lldb::tid_t tid,33 StructuredData::GenericSP script_object_sp = nullptr);34 35 ~ScriptedThread() override;36 37 static llvm::Expected<std::shared_ptr<ScriptedThread>>38 Create(ScriptedProcess &process,39 StructuredData::Generic *script_object = nullptr);40 41 lldb::RegisterContextSP GetRegisterContext() override;42 43 lldb::RegisterContextSP44 CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override;45 46 bool LoadArtificialStackFrames();47 48 bool CalculateStopInfo() override;49 50 const char *GetInfo() override { return nullptr; }51 52 const char *GetName() override;53 54 const char *GetQueueName() override;55 56 void WillResume(lldb::StateType resume_state) override;57 58 void RefreshStateAfterStop() override;59 60 void ClearStackFrames() override;61 62 StructuredData::ObjectSP FetchThreadExtendedInfo() override;63 64private:65 friend class ScriptedFrame;66 67 void CheckInterpreterAndScriptObject() const;68 lldb::ScriptedThreadInterfaceSP GetInterface() const;69 70 ScriptedThread(const ScriptedThread &) = delete;71 const ScriptedThread &operator=(const ScriptedThread &) = delete;72 73 std::shared_ptr<DynamicRegisterInfo> GetDynamicRegisterInfo();74 75 const ScriptedProcess &m_scripted_process;76 lldb::ScriptedThreadInterfaceSP m_scripted_thread_interface_sp = nullptr;77 lldb_private::StructuredData::GenericSP m_script_object_sp = nullptr;78 std::shared_ptr<DynamicRegisterInfo> m_register_info_sp = nullptr;79};80 81} // namespace lldb_private82 83#endif // LLDB_SOURCE_PLUGINS_SCRIPTED_THREAD_H84