xref: /llvm-project/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn (revision 13956fd27f59f7570a49c2155f09caf8e1297796)
1import("//llvm/lib/Target/targets.gni")
2import("//llvm/utils/gn/build/write_cmake_config.gni")
3
4# In the CMake build, each plugin calls `add_lldb_library(name PLUGIN ...)`,
5# which implicitly adds the plugin name to the LLDB_PLUGINS list.
6# A few places then query that list and add dependencies on it.
7# lldb/source/Plugins/CMakeList.txt then does string munging on the list of
8# plugin names to generate Plugins.def.
9# In the GN build, we instead have an explicit list of all plugins here.
10# Every entry in this list is a (GN target, LLDB_PLUGIN Plugins.def name) pair.
11lldb_plugins = []
12if (llvm_build_X86) {
13  lldb_plugins += [ [
14        "//lldb/source/Plugins/ABI/X86",
15        "ABIX86",
16      ] ]
17}
18lldb_plugins += [
19  [
20    "//lldb/source/Plugins/Architecture/PPC64",
21    "ArchitecturePPC64",
22  ],
23  [
24    "//lldb/source/Plugins/Disassembler/LLVMC",
25    "DisassemblerLLVMC",
26  ],
27  [
28    "//lldb/source/Plugins/DynamicLoader/Darwin-Kernel",
29    "DynamicLoaderDarwinKernel",
30  ],
31  [
32    "//lldb/source/Plugins/DynamicLoader/MacOSX-DYLD",
33    "DynamicLoaderMacOSXDYLD",
34  ],
35  [
36    "//lldb/source/Plugins/DynamicLoader/POSIX-DYLD",
37    "DynamicLoaderPosixDYLD",
38  ],
39  [
40    "//lldb/source/Plugins/DynamicLoader/Static",
41    "DynamicLoaderStatic",
42  ],
43  [
44    "//lldb/source/Plugins/DynamicLoader/Windows-DYLD",
45    "DynamicLoaderWindowsDYLD",
46  ],
47  [
48    "//lldb/source/Plugins/Instruction/ARM",
49    "InstructionARM",
50  ],
51  [
52    "//lldb/source/Plugins/JITLoader/GDB",
53    "JITLoaderGDB",
54  ],
55  [
56    "//lldb/source/Plugins/Language/CPlusPlus",
57    "CPlusPlusLanguage",
58  ],
59  [
60    "//lldb/source/Plugins/Language/ObjC",
61    "ObjCLanguage",
62  ],
63  [
64    "//lldb/source/Plugins/Language/ObjCPlusPlus",
65    "ObjCPlusPlusLanguage",
66  ],
67  [
68    "//lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI",
69    "CXXItaniumABI",
70  ],
71  [
72    "//lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime",
73    "AppleObjCRuntime",
74  ],
75  [
76    "//lldb/source/Plugins/ObjectContainer/BSD-Archive",
77    "ObjectContainerBSDArchive",
78  ],
79  [
80    "//lldb/source/Plugins/ObjectContainer/Universal-Mach-O",
81    "ObjectContainerMachOArchive",
82  ],
83  [
84    "//lldb/source/Plugins/ObjectFile/Breakpad",
85    "ObjectFileBreakpad",
86  ],
87  [
88    "//lldb/source/Plugins/ObjectFile/ELF",
89    "ObjectFileELF",
90  ],
91  [
92    "//lldb/source/Plugins/ObjectFile/Mach-O",
93    "ObjectFileMachO",
94  ],
95  [
96    "//lldb/source/Plugins/ObjectFile/PDB",
97    "ObjectFilePDB",
98  ],
99  [
100    "//lldb/source/Plugins/ObjectFile/PECOFF",
101    "ObjectFilePECOFF",
102  ],
103  [
104    "//lldb/source/Plugins/ObjectFile/Placeholder",
105    "ObjectFilePlaceholder",
106  ],
107  [
108    "//lldb/source/Plugins/ObjectFile/wasm",
109    "ObjectFileWasm",
110  ],
111  [
112    "//lldb/source/Plugins/Platform/Linux",
113    "PlatformLinux",
114  ],
115  [
116    "//lldb/source/Plugins/Platform/MacOSX",
117    "PlatformMacOSX",
118  ],
119  [
120    "//lldb/source/Plugins/Platform/Windows",
121    "PlatformWindows",
122  ],
123  [
124    "//lldb/source/Plugins/Process/elf-core",
125    "ProcessElfCore",
126  ],
127  [
128    "//lldb/source/Plugins/Process/gdb-remote",
129    "",  # Uses LLDB_PROCESS_GDB_PLUGIN instead.
130  ],
131  [
132    "//lldb/source/Plugins/Process/mach-core",
133    "ProcessMachCore",
134  ],
135  [
136    "//lldb/source/Plugins/Process/minidump",
137    "ProcessMinidump",
138  ],
139  [
140    "//lldb/source/Plugins/REPL/Clang",
141    "ClangREPL",
142  ],
143  [
144    "//lldb/source/Plugins/ScriptInterpreter/None",
145    "",  # Uses LLDB_SCRIPT_PLUGIN instead.
146  ],
147  [
148    "//lldb/source/Plugins/SymbolFile/Breakpad",
149    "SymbolFileBreakpad",
150  ],
151  [
152    "//lldb/source/Plugins/SymbolFile/DWARF",
153    "SymbolFileDWARF",
154  ],
155  [
156    "//lldb/source/Plugins/SymbolFile/PDB",
157    "SymbolFilePDB",
158  ],
159  [
160    "//lldb/source/Plugins/SymbolFile/Symtab",
161    "SymbolFileSymtab",
162  ],
163  [
164    "//lldb/source/Plugins/SymbolLocator/Default",
165    "SymbolLocatorDefault",
166  ],
167]
168if (current_os == "mac") {
169  lldb_plugins += [
170    [
171      "//lldb/source/Plugins/SymbolLocator/DebugSymbols",
172      "SymbolLocatorDebugSymbols",
173    ],
174    [
175      "//lldb/source/Plugins/SymbolVendor/MacOSX",
176      "SymbolVendorMacOSX",
177    ],
178  ]
179}
180lldb_plugins += [
181  [
182    "//lldb/source/Plugins/SymbolVendor/ELF",
183    "SymbolVendorELF",
184  ],
185
186  [
187    "//lldb/source/Plugins/SymbolVendor/wasm",
188    "SymbolVendorWasm",
189  ],
190
191  [
192    "//lldb/source/Plugins/SymbolVendor/PECOFF",
193    "SymbolVendorPECOFF",
194  ],
195
196  [
197    "//lldb/source/Plugins/TypeSystem/Clang",
198    "TypeSystemClang",
199  ],
200
201  [
202    "//lldb/source/Plugins/UnwindAssembly/InstEmulation",
203    "UnwindAssemblyInstEmulation",
204  ],
205  [
206    "//lldb/source/Plugins/UnwindAssembly/x86",
207    "UnwindAssemblyX86",
208  ],
209]
210
211write_cmake_config("Plugins.def") {
212  input = "Plugins.def.in"
213  output = "$target_gen_dir/Plugins.def"
214
215  enum_plugins = ""
216  foreach(plugin, lldb_plugins) {
217    plugin_id = plugin[1]
218    if (plugin_id != "") {
219      # \n is a literal '\' followed by a literal 'n', not a newline character.
220      # write_cmake_config.py replaces it with a real newline.
221      enum_plugins += "LLDB_PLUGIN(" + plugin_id + ")\n"
222    }
223  }
224
225  deps = [ "//lldb/source/Plugins/ScriptInterpreter/None" ]
226  enum_plugins += "LLDB_SCRIPT_PLUGIN(ScriptInterpreterNone)"
227
228  values = [ "LLDB_ENUM_PLUGINS=" + enum_plugins ]
229
230  # These are in separate variables to make sure ProcessWindowsCommon is
231  # initalized after all plugins, but before ProcessGDBRemote.
232  if (current_os == "win") {
233    values +=
234        [ "LLDB_PROCESS_WINDOWS_PLUGIN=LLDB_PLUGIN(ProcessWindowsCommon)" ]
235  } else {
236    values += [ "LLDB_PROCESS_WINDOWS_PLUGIN=" ]
237  }
238  values += [ "LLDB_PROCESS_GDB_PLUGIN=LLDB_PLUGIN(ProcessGDBRemote)" ]
239}
240
241config("AllLldbPlugins_config") {
242  visibility = [ ":LldbAllPlugins" ]
243
244  # To pick up Plugins.def.
245  include_dirs = [ "$root_gen_dir/lldb/source" ]
246}
247
248group("LldbAllPlugins") {
249  deps = [ ":Plugins.def" ]
250  foreach(plugin, lldb_plugins) {
251    deps += [ plugin[0] ]
252  }
253  public_configs = [ ":AllLldbPlugins_config" ]
254}
255