xref: /freebsd/contrib/llvm-project/lldb/include/lldb/lldb-private-interfaces.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
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::ProtocolServerUP (*ProtocolServerCreateInstance)();
85 typedef lldb::RegisterTypeBuilderSP (*RegisterTypeBuilderCreateInstance)(
86     Target &target);
87 typedef lldb::ScriptInterpreterSP (*ScriptInterpreterCreateInstance)(
88     Debugger &debugger);
89 typedef SymbolFile *(*SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp);
90 typedef SymbolVendor *(*SymbolVendorCreateInstance)(
91     const lldb::ModuleSP &module_sp,
92     lldb_private::Stream
93         *feedback_strm); // Module can be NULL for default system symbol vendor
94 typedef SymbolLocator *(*SymbolLocatorCreateInstance)();
95 typedef std::optional<ModuleSpec> (*SymbolLocatorLocateExecutableObjectFile)(
96     const ModuleSpec &module_spec);
97 typedef std::optional<FileSpec> (*SymbolLocatorFindSymbolFileInBundle)(
98     const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch);
99 typedef std::optional<FileSpec> (*SymbolLocatorLocateExecutableSymbolFile)(
100     const ModuleSpec &module_spec, const FileSpecList &default_search_paths);
101 typedef bool (*SymbolLocatorDownloadObjectAndSymbolFile)(
102     ModuleSpec &module_spec, Status &error, bool force_lookup,
103     bool copy_executable);
104 using BreakpointHitCallback =
105     std::function<bool(void *baton, StoppointCallbackContext *context,
106                        lldb::user_id_t break_id, lldb::user_id_t break_loc_id)>;
107 
108 typedef bool (*WatchpointHitCallback)(void *baton,
109                                       StoppointCallbackContext *context,
110                                       lldb::user_id_t watch_id);
111 typedef bool (*ThreadPlanShouldStopHereCallback)(
112     ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation,
113     Status &status, void *baton);
114 typedef lldb::ThreadPlanSP (*ThreadPlanStepFromHereCallback)(
115     ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation,
116     Status &status, void *baton);
117 typedef UnwindAssembly *(*UnwindAssemblyCreateInstance)(const ArchSpec &arch);
118 typedef lldb::MemoryHistorySP (*MemoryHistoryCreateInstance)(
119     const lldb::ProcessSP &process_sp);
120 typedef lldb::InstrumentationRuntimeType (*InstrumentationRuntimeGetType)();
121 typedef lldb::InstrumentationRuntimeSP (*InstrumentationRuntimeCreateInstance)(
122     const lldb::ProcessSP &process_sp);
123 typedef lldb::TypeSystemSP (*TypeSystemCreateInstance)(
124     lldb::LanguageType language, Module *module, Target *target);
125 typedef lldb::REPLSP (*REPLCreateInstance)(Status &error,
126                                            lldb::LanguageType language,
127                                            Debugger *debugger, Target *target,
128                                            const char *repl_options);
129 typedef bool (*ScriptedInterfaceCreateInstance)(lldb::ScriptLanguage language,
130                                                 ScriptedInterfaceUsages usages);
131 typedef int (*ComparisonFunction)(const void *, const void *);
132 typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
133 /// Trace
134 /// \{
135 typedef llvm::Expected<lldb::TraceSP> (*TraceCreateInstanceFromBundle)(
136     const llvm::json::Value &trace_bundle_description,
137     llvm::StringRef session_file_dir, lldb_private::Debugger &debugger);
138 typedef llvm::Expected<lldb::TraceSP> (*TraceCreateInstanceForLiveProcess)(
139     Process &process);
140 typedef llvm::Expected<lldb::TraceExporterUP> (*TraceExporterCreateInstance)();
141 typedef lldb::CommandObjectSP (*ThreadTraceExportCommandCreator)(
142     CommandInterpreter &interpreter);
143 /// \}
144 } // namespace lldb_private
145 
146 #endif // LLDB_LLDB_PRIVATE_INTERFACES_H
147