LLDB mainline
ScriptedFrameProviderInterface.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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_INTERPRETER_INTERFACES_SCRIPTEDFRAMEPROVIDERINTERFACE_H
10#define LLDB_INTERPRETER_INTERFACES_SCRIPTEDFRAMEPROVIDERINTERFACE_H
11
12#include "lldb/lldb-private.h"
13
14#include "ScriptedInterface.h"
15
16namespace lldb_private {
18public:
19 virtual bool AppliesToThread(llvm::StringRef class_name,
20 lldb::ThreadSP thread_sp) {
21 return true;
22 }
23
24 virtual llvm::Expected<StructuredData::GenericSP>
25 CreatePluginObject(const ScriptedMetadata &scripted_metadata,
26 lldb::StackFrameListSP input_frames) = 0;
27
28 /// Get a description string for the frame provider.
29 ///
30 /// This is called by the descriptor to fetch a description from the
31 /// scripted implementation. Implementations should call a static method
32 /// on the scripting class to retrieve the description.
33 ///
34 /// \param class_name The name of the scripting class implementing the
35 /// provider.
36 ///
37 /// \return A string describing what this frame provider does, or an
38 /// empty string if no description is available.
39 virtual std::string GetDescription(llvm::StringRef class_name) { return {}; }
40
41 /// Get the priority of this frame provider.
42 ///
43 /// This is called by the descriptor to fetch the priority from the
44 /// scripted implementation. Implementations should call a static method
45 /// on the scripting class to retrieve the priority. Lower numbers indicate
46 /// higher priority (like Unix nice values).
47 ///
48 /// \param class_name The name of the scripting class implementing the
49 /// provider.
50 ///
51 /// \return Priority value where 0 is highest priority, or std::nullopt for
52 /// default priority (UINT32_MAX - lowest priority).
53 virtual std::optional<uint32_t> GetPriority(llvm::StringRef class_name) {
54 return std::nullopt;
55 }
56
57 virtual StructuredData::ObjectSP GetFrameAtIndex(uint32_t index) {
58 return {};
59 }
60};
61} // namespace lldb_private
62
63#endif // LLDB_INTERPRETER_INTERFACES_SCRIPTEDFRAMEPROVIDERINTERFACE_H
virtual std::optional< uint32_t > GetPriority(llvm::StringRef class_name)
Get the priority of this frame provider.
virtual StructuredData::ObjectSP GetFrameAtIndex(uint32_t index)
virtual llvm::Expected< StructuredData::GenericSP > CreatePluginObject(const ScriptedMetadata &scripted_metadata, lldb::StackFrameListSP input_frames)=0
virtual std::string GetDescription(llvm::StringRef class_name)
Get a description string for the frame provider.
virtual bool AppliesToThread(llvm::StringRef class_name, lldb::ThreadSP thread_sp)
std::shared_ptr< Object > ObjectSP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::StackFrameList > StackFrameListSP