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