xref: /llvm-project/lldb/include/lldb/lldb-private-interfaces.h (revision f109517d153609d4a8a3a3d3d3cc06da1b629364)
1 //===-- lldb-private-interfaces.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_LLDB_PRIVATE_INTERFACES_H
10 #define LLDB_LLDB_PRIVATE_INTERFACES_H
11 
12 #include "lldb/lldb-enumerations.h"
13 #include "lldb/lldb-forward.h"
14 #include "lldb/lldb-private-enumerations.h"
15 #include "lldb/lldb-types.h"
16 #include <memory>
17 #include <set>
18 
19 namespace llvm {
20 namespace json {
21 class Object;
22 class Value;
23 }
24 } // namespace llvm
25 
26 namespace lldb_private {
27 class ScriptedInterfaceUsages;
28 typedef lldb::ABISP (*ABICreateInstance)(lldb::ProcessSP process_sp,
29                                          const ArchSpec &arch);
30 typedef std::unique_ptr<Architecture> (*ArchitectureCreateInstance)(
31     const ArchSpec &arch);
32 typedef lldb::DisassemblerSP (*DisassemblerCreateInstance)(
33     const ArchSpec &arch, const char *flavor, const char *cpu,
34     const char *features);
35 typedef DynamicLoader *(*DynamicLoaderCreateInstance)(Process *process,
36                                                       bool force);
37 typedef lldb::JITLoaderSP (*JITLoaderCreateInstance)(Process *process,
38                                                      bool force);
39 typedef ObjectContainer *(*ObjectContainerCreateInstance)(
40     const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
41     lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset,
42     lldb::offset_t length);
43 typedef ObjectContainer *(*ObjectContainerCreateMemoryInstance)(
44     const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
45     const lldb::ProcessSP &process_sp, lldb::addr_t offset);
46 typedef size_t (*ObjectFileGetModuleSpecifications)(
47     const FileSpec &file, lldb::DataBufferSP &data_sp,
48     lldb::offset_t data_offset, lldb::offset_t file_offset,
49     lldb::offset_t length, ModuleSpecList &module_specs);
50 typedef ObjectFile *(*ObjectFileCreateInstance)(const lldb::ModuleSP &module_sp,
51                                                 lldb::DataBufferSP data_sp,
52                                                 lldb::offset_t data_offset,
53                                                 const FileSpec *file,
54                                                 lldb::offset_t file_offset,
55                                                 lldb::offset_t length);
56 typedef ObjectFile *(*ObjectFileCreateMemoryInstance)(
57     const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
58     const lldb::ProcessSP &process_sp, lldb::addr_t offset);
59 typedef bool (*ObjectFileSaveCore)(const lldb::ProcessSP &process_sp,
60                                    lldb_private::SaveCoreOptions &options,
61                                    Status &error);
62 typedef EmulateInstruction *(*EmulateInstructionCreateInstance)(
63     const ArchSpec &arch, InstructionType inst_type);
64 typedef OperatingSystem *(*OperatingSystemCreateInstance)(Process *process,
65                                                           bool force);
66 typedef Language *(*LanguageCreateInstance)(lldb::LanguageType language);
67 typedef LanguageRuntime *(*LanguageRuntimeCreateInstance)(
68     Process *process, lldb::LanguageType language);
69 typedef lldb::CommandObjectSP (*LanguageRuntimeGetCommandObject)(
70     CommandInterpreter &interpreter);
71 typedef lldb::BreakpointPreconditionSP (
72     *LanguageRuntimeGetExceptionPrecondition)(lldb::LanguageType language,
73                                               bool throw_bp);
74 typedef lldb::StructuredDataPluginSP (*StructuredDataPluginCreateInstance)(
75     Process &process);
76 typedef Status (*StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info,
77                                                  Target *target);
78 typedef SystemRuntime *(*SystemRuntimeCreateInstance)(Process *process);
79 typedef lldb::PlatformSP (*PlatformCreateInstance)(bool force,
80                                                    const ArchSpec *arch);
81 typedef lldb::ProcessSP (*ProcessCreateInstance)(
82     lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
83     const FileSpec *crash_file_path, bool can_connect);
84 typedef lldb::RegisterTypeBuilderSP (*RegisterTypeBuilderCreateInstance)(
85     Target &target);
86 typedef lldb::ScriptInterpreterSP (*ScriptInterpreterCreateInstance)(
87     Debugger &debugger);
88 typedef SymbolFile *(*SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp);
89 typedef SymbolVendor *(*SymbolVendorCreateInstance)(
90     const lldb::ModuleSP &module_sp,
91     lldb_private::Stream
92         *feedback_strm); // Module can be NULL for default system symbol vendor
93 typedef SymbolLocator *(*SymbolLocatorCreateInstance)();
94 typedef std::optional<ModuleSpec> (*SymbolLocatorLocateExecutableObjectFile)(
95     const ModuleSpec &module_spec);
96 typedef std::optional<FileSpec> (*SymbolLocatorFindSymbolFileInBundle)(
97     const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch);
98 typedef std::optional<FileSpec> (*SymbolLocatorLocateExecutableSymbolFile)(
99     const ModuleSpec &module_spec, const FileSpecList &default_search_paths);
100 typedef bool (*SymbolLocatorDownloadObjectAndSymbolFile)(
101     ModuleSpec &module_spec, Status &error, bool force_lookup,
102     bool copy_executable);
103 using BreakpointHitCallback =
104     std::function<bool(void *baton, StoppointCallbackContext *context,
105                        lldb::user_id_t break_id, lldb::user_id_t break_loc_id)>;
106 
107 typedef bool (*WatchpointHitCallback)(void *baton,
108                                       StoppointCallbackContext *context,
109                                       lldb::user_id_t watch_id);
110 typedef bool (*ThreadPlanShouldStopHereCallback)(
111     ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation,
112     Status &status, void *baton);
113 typedef lldb::ThreadPlanSP (*ThreadPlanStepFromHereCallback)(
114     ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation,
115     Status &status, void *baton);
116 typedef UnwindAssembly *(*UnwindAssemblyCreateInstance)(const ArchSpec &arch);
117 typedef lldb::MemoryHistorySP (*MemoryHistoryCreateInstance)(
118     const lldb::ProcessSP &process_sp);
119 typedef lldb::InstrumentationRuntimeType (*InstrumentationRuntimeGetType)();
120 typedef lldb::InstrumentationRuntimeSP (*InstrumentationRuntimeCreateInstance)(
121     const lldb::ProcessSP &process_sp);
122 typedef lldb::TypeSystemSP (*TypeSystemCreateInstance)(
123     lldb::LanguageType language, Module *module, Target *target);
124 typedef lldb::REPLSP (*REPLCreateInstance)(Status &error,
125                                            lldb::LanguageType language,
126                                            Debugger *debugger, Target *target,
127                                            const char *repl_options);
128 typedef bool (*ScriptedInterfaceCreateInstance)(lldb::ScriptLanguage language,
129                                                 ScriptedInterfaceUsages usages);
130 typedef int (*ComparisonFunction)(const void *, const void *);
131 typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
132 /// Trace
133 /// \{
134 typedef llvm::Expected<lldb::TraceSP> (*TraceCreateInstanceFromBundle)(
135     const llvm::json::Value &trace_bundle_description,
136     llvm::StringRef session_file_dir, lldb_private::Debugger &debugger);
137 typedef llvm::Expected<lldb::TraceSP> (*TraceCreateInstanceForLiveProcess)(
138     Process &process);
139 typedef llvm::Expected<lldb::TraceExporterUP> (*TraceExporterCreateInstance)();
140 typedef lldb::CommandObjectSP (*ThreadTraceExportCommandCreator)(
141     CommandInterpreter &interpreter);
142 /// \}
143 } // namespace lldb_private
144 
145 #endif // LLDB_LLDB_PRIVATE_INTERFACES_H
146