| 1 |
# This file is licensed under the Apache License v2.0 with LLVM Exceptions. |
| 2 |
# See https://llvm.org/LICENSE.txt for license information. |
| 3 |
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 |
|
| 5 |
load("@bazel_skylib//lib:selects.bzl", "selects") |
| 6 |
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") |
| 7 |
load("@bazel_skylib//rules:expand_template.bzl", "expand_template") |
| 8 |
load("@build_bazel_apple_support//rules:apple_genrule.bzl", "apple_genrule") |
| 9 |
load("//:vars.bzl", "LLVM_VERSION_MAJOR", "LLVM_VERSION_MINOR", "LLVM_VERSION_PATCH", "LLVM_VERSION_SUFFIX", "PACKAGE_VERSION") |
| 10 |
load("//lldb/source/Plugins:plugin_config.bzl", "DEFAULT_PLUGINS", "DEFAULT_SCRIPT_PLUGINS", "OBJCPP_COPTS") |
| 11 |
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") |
| 12 |
|
| 13 |
package( |
| 14 |
default_visibility = ["//visibility:public"], |
| 15 |
features = ["layering_check"], |
| 16 |
) |
| 17 |
|
| 18 |
licenses(["notice"]) |
| 19 |
|
| 20 |
exports_files([ |
| 21 |
"LICENSE.TXT", |
| 22 |
"source/API/liblldb-private.exports", |
| 23 |
"source/API/liblldb.exports", |
| 24 |
]) |
| 25 |
|
| 26 |
bool_flag( |
| 27 |
name = "enable_curses", |
| 28 |
build_setting_default = False, |
| 29 |
) |
| 30 |
|
| 31 |
config_setting( |
| 32 |
name = "curses_enabled_setting", |
| 33 |
flag_values = {":enable_curses": "true"}, |
| 34 |
) |
| 35 |
|
| 36 |
selects.config_setting_group( |
| 37 |
name = "curses_enabled", |
| 38 |
match_any = [ |
| 39 |
":curses_enabled_setting", |
| 40 |
"@platforms//os:macos", |
| 41 |
], |
| 42 |
) |
| 43 |
|
| 44 |
bool_flag( |
| 45 |
name = "enable_libedit", |
| 46 |
build_setting_default = False, |
| 47 |
) |
| 48 |
|
| 49 |
config_setting( |
| 50 |
name = "libedit_enabled_setting", |
| 51 |
flag_values = {":enable_libedit": "true"}, |
| 52 |
) |
| 53 |
|
| 54 |
selects.config_setting_group( |
| 55 |
name = "libedit_enabled", |
| 56 |
match_any = [ |
| 57 |
":libedit_enabled_setting", |
| 58 |
"@platforms//os:macos", |
| 59 |
], |
| 60 |
) |
| 61 |
|
| 62 |
_VERSION_SUBSTITUTIONS = { |
| 63 |
"@LLDB_VERSION@": PACKAGE_VERSION, |
| 64 |
"@LLDB_VERSION_MAJOR@": LLVM_VERSION_MAJOR, |
| 65 |
"@LLDB_VERSION_MINOR@": LLVM_VERSION_MINOR, |
| 66 |
"@LLDB_VERSION_PATCH@": LLVM_VERSION_PATCH, |
| 67 |
"@LLDB_VERSION_SUFFIX@": LLVM_VERSION_SUFFIX, |
| 68 |
'#cmakedefine LLDB_FULL_VERSION_STRING "@LLDB_FULL_VERSION_STRING@"': "/* #undef LLDB_FULL_VERSION_STRING */", |
| 69 |
} |
| 70 |
|
| 71 |
genrule( |
| 72 |
name = "vcs_version_gen", |
| 73 |
outs = ["VCSVersion.inc"], |
| 74 |
cmd = "echo '#undef LLDB_REVISION' >> $@\n" + |
| 75 |
"echo '#undef LLDB_REPOSITORY' >> $@\n", |
| 76 |
) |
| 77 |
|
| 78 |
expand_template( |
| 79 |
name = "version_inc_gen", |
| 80 |
out = "Version/Version.inc", |
| 81 |
substitutions = _VERSION_SUBSTITUTIONS, |
| 82 |
template = "include/lldb/Version/Version.inc.in", |
| 83 |
) |
| 84 |
|
| 85 |
cc_library( |
| 86 |
name = "Version", |
| 87 |
srcs = [ |
| 88 |
"source/Version/Version.cpp", |
| 89 |
":vcs_version_gen", |
| 90 |
":version_inc_gen", |
| 91 |
], |
| 92 |
hdrs = ["include/lldb/Version/Version.h"], |
| 93 |
features = ["-layering_check"], # Version.inc breaks this unintentionally |
| 94 |
strip_include_prefix = "include", |
| 95 |
deps = ["//clang:basic"], |
| 96 |
) |
| 97 |
|
| 98 |
expand_template( |
| 99 |
name = "ConfigHeader", |
| 100 |
out = "include/lldb/Host/Config.h", |
| 101 |
substitutions = { |
| 102 |
"#cmakedefine01 HAVE_PTSNAME_R": "#define HAVE_PTSNAME_R 1", |
| 103 |
"#cmakedefine01 LLDB_ENABLE_TERMIOS": "#define LLDB_ENABLE_TERMIOS 1", |
| 104 |
|
| 105 |
# TODO: Add LZMA support by including the library in bazel |
| 106 |
"#cmakedefine01 LLDB_ENABLE_LZMA": "#define LLDB_ENABLE_LZMA 0", |
| 107 |
|
| 108 |
# TODO: lua support |
| 109 |
"#cmakedefine01 LLDB_ENABLE_LUA": "#define LLDB_ENABLE_LUA 0", |
| 110 |
|
| 111 |
# TODO: curl support |
| 112 |
"#cmakedefine01 LLVM_ENABLE_CURL": "#define LLVM_ENABLE_CURL 0", |
| 113 |
|
| 114 |
# TODO: python support |
| 115 |
"#cmakedefine01 LLDB_ENABLE_PYTHON": "#define LLDB_ENABLE_PYTHON 0", |
| 116 |
# Only enabled by default on Windows |
| 117 |
"#cmakedefine01 LLDB_EMBED_PYTHON_HOME": "#define LLDB_EMBED_PYTHON_HOME 0", |
| 118 |
# Only used if LLDB_EMBED_PYTHON_HOME is true |
| 119 |
"#cmakedefine LLDB_PYTHON_HOME R\"(${LLDB_PYTHON_HOME})\"": "#define LLDB_PYTHON_HOME \"\"", |
| 120 |
|
| 121 |
# Unsupported |
| 122 |
"#cmakedefine01 CURSES_HAVE_NCURSES_CURSES_H": "#define CURSES_HAVE_NCURSES_CURSES_H 0", |
| 123 |
"#cmakedefine01 LLDB_ENABLE_FBSDVMCORE": "#define LLDB_ENABLE_FBSDVMCORE 0", |
| 124 |
|
| 125 |
# Defaults that could be configurable if needed |
| 126 |
"#cmakedefine01 LLDB_ENABLE_POSIX": "#define LLDB_ENABLE_POSIX 1", |
| 127 |
"#cmakedefine LLDB_GLOBAL_INIT_DIRECTORY R\"(${LLDB_GLOBAL_INIT_DIRECTORY})\"": "#define LLDB_GLOBAL_INIT_DIRECTORY \"\"", |
| 128 |
"${LLDB_INSTALL_LIBDIR_BASENAME}": "lib", |
| 129 |
"${LLDB_BUG_REPORT_URL}": "", |
| 130 |
} | select({ |
| 131 |
"@platforms//os:macos": { |
| 132 |
"#cmakedefine HAVE_LIBCOMPRESSION": "#define HAVE_LIBCOMPRESSION", |
| 133 |
"#cmakedefine01 HAVE_NR_PROCESS_VM_READV": "#define HAVE_NR_PROCESS_VM_READV 0", |
| 134 |
"#cmakedefine01 HAVE_PPOLL": "#define HAVE_PPOLL 0", |
| 135 |
"#cmakedefine01 HAVE_PROCESS_VM_READV": "#define HAVE_PROCESS_VM_READV 0", |
| 136 |
"#cmakedefine01 HAVE_SYS_EVENT_H": "#define HAVE_SYS_EVENT_H 1", |
| 137 |
"#cmakedefine01 LLDB_ENABLE_LIBXML2": "#define LLDB_ENABLE_LIBXML2 1", |
| 138 |
"#cmakedefine01 LLDB_HAVE_EL_RFUNC_T": "#define LLDB_HAVE_EL_RFUNC_T 0", |
| 139 |
}, |
| 140 |
"@platforms//os:linux": { |
| 141 |
"#cmakedefine HAVE_LIBCOMPRESSION": "/* #undef HAVE_LIBCOMPRESSION */", |
| 142 |
"#cmakedefine01 HAVE_NR_PROCESS_VM_READV": "#define HAVE_NR_PROCESS_VM_READV 1", |
| 143 |
"#cmakedefine01 HAVE_PPOLL": "#define HAVE_PPOLL 1", |
| 144 |
"#cmakedefine01 HAVE_PROCESS_VM_READV": "#define HAVE_PROCESS_VM_READV 1", |
| 145 |
"#cmakedefine01 HAVE_SYS_EVENT_H": "#define HAVE_SYS_EVENT_H 0", |
| 146 |
"#cmakedefine01 LLDB_ENABLE_LIBXML2": "#define LLDB_ENABLE_LIBXML2 0", |
| 147 |
"#cmakedefine01 LLDB_HAVE_EL_RFUNC_T": "#define LLDB_HAVE_EL_RFUNC_T 1", |
| 148 |
}, |
| 149 |
}) | select({ |
| 150 |
":curses_enabled": { |
| 151 |
"#cmakedefine01 LLDB_ENABLE_CURSES": "#define LLDB_ENABLE_CURSES 1", |
| 152 |
}, |
| 153 |
"//conditions:default": { |
| 154 |
"#cmakedefine01 LLDB_ENABLE_CURSES": "#define LLDB_ENABLE_CURSES 0", |
| 155 |
}, |
| 156 |
}) | select({ |
| 157 |
":libedit_enabled": { |
| 158 |
"#cmakedefine01 LLDB_EDITLINE_USE_WCHAR": "#define LLDB_EDITLINE_USE_WCHAR 1", |
| 159 |
"#cmakedefine01 LLDB_ENABLE_LIBEDIT": "#define LLDB_ENABLE_LIBEDIT 1", |
| 160 |
}, |
| 161 |
"//conditions:default": { |
| 162 |
"#cmakedefine01 LLDB_EDITLINE_USE_WCHAR": "#define LLDB_EDITLINE_USE_WCHAR 0", |
| 163 |
"#cmakedefine01 LLDB_ENABLE_LIBEDIT": "#define LLDB_ENABLE_LIBEDIT 0", |
| 164 |
}, |
| 165 |
}), |
| 166 |
template = "include/lldb/Host/Config.h.cmake", |
| 167 |
) |
| 168 |
|
| 169 |
cc_library( |
| 170 |
name = "Config", |
| 171 |
hdrs = [":ConfigHeader"], |
| 172 |
include_prefix = "lldb/Host", |
| 173 |
) |
| 174 |
|
| 175 |
cc_binary( |
| 176 |
name = "lldb-tblgen", |
| 177 |
srcs = glob([ |
| 178 |
"utils/TableGen/*.cpp", |
| 179 |
"utils/TableGen/*.h", |
| 180 |
]), |
| 181 |
deps = [ |
| 182 |
"//llvm:CodeGenTypes", |
| 183 |
"//llvm:Support", |
| 184 |
"//llvm:TableGen", |
| 185 |
"//llvm:TargetParser", |
| 186 |
"//llvm:config", |
| 187 |
], |
| 188 |
) |
| 189 |
|
| 190 |
py_binary( |
| 191 |
name = "generate-sbapi-dwarf-enum", |
| 192 |
srcs = ["scripts/generate-sbapi-dwarf-enum.py"], |
| 193 |
) |
| 194 |
|
| 195 |
genrule( |
| 196 |
name = "lldb-sbapi-dwarf-enums", |
| 197 |
srcs = ["//llvm:include/llvm/BinaryFormat/Dwarf.def"], |
| 198 |
outs = ["include/lldb/API/SBLanguages.h"], |
| 199 |
cmd = "$(location :generate-sbapi-dwarf-enum) $(location //llvm:include/llvm/BinaryFormat/Dwarf.def) --output $@", |
| 200 |
tools = [":generate-sbapi-dwarf-enum"], |
| 201 |
) |
| 202 |
|
| 203 |
cc_library( |
| 204 |
name = "API", |
| 205 |
srcs = glob([ |
| 206 |
"source/API/**/*.cpp", |
| 207 |
"source/API/**/*.h", |
| 208 |
]), |
| 209 |
hdrs = glob(["include/lldb/API/**/*.h"]) + [":lldb-sbapi-dwarf-enums"], |
| 210 |
strip_include_prefix = "include", |
| 211 |
deps = [ |
| 212 |
":Breakpoint", |
| 213 |
":Commands", |
| 214 |
":Core", |
| 215 |
":DataFormatters", |
| 216 |
":Expression", |
| 217 |
":Headers", |
| 218 |
":Host", |
| 219 |
":Initialization", |
| 220 |
":InterpreterHeaders", |
| 221 |
":Symbol", |
| 222 |
":SymbolHeaders", |
| 223 |
":Target", |
| 224 |
":TargetHeaders", |
| 225 |
":Utility", |
| 226 |
":Version", |
| 227 |
"//lldb/source/Plugins:PluginExpressionParserClang", |
| 228 |
"//lldb/source/Plugins:PluginExpressionParserClangHeaders", |
| 229 |
"//lldb/source/Plugins:PluginsConfig", |
| 230 |
"//llvm:AllTargetsDisassemblers", |
| 231 |
"//llvm:ExecutionEngine", |
| 232 |
"//llvm:MCJIT", |
| 233 |
"//llvm:Support", |
| 234 |
"//llvm:config", |
| 235 |
] + [ |
| 236 |
"//lldb/source/Plugins:Plugin{}".format(x) |
| 237 |
for x in DEFAULT_PLUGINS + DEFAULT_SCRIPT_PLUGINS |
| 238 |
] + select({ |
| 239 |
"@platforms//os:macos": [ |
| 240 |
"//lldb/source/Plugins:PluginProcessMacOSXKernel", |
| 241 |
"//lldb/source/Plugins:PluginSymbolLocatorDebugSymbols", |
| 242 |
"//lldb/source/Plugins:PluginSymbolVendorMacOSX", |
| 243 |
], |
| 244 |
"@platforms//os:linux": [ |
| 245 |
"//lldb/source/Plugins:PluginProcessLinux", |
| 246 |
], |
| 247 |
"//conditions:default": [], |
| 248 |
}), |
| 249 |
alwayslink = True, |
| 250 |
) |
| 251 |
|
| 252 |
cc_library( |
| 253 |
name = "Breakpoint", |
| 254 |
srcs = glob(["source/Breakpoint/**/*.cpp"]), |
| 255 |
hdrs = glob(["include/lldb/Breakpoint/**/*.h"]), |
| 256 |
strip_include_prefix = "include", |
| 257 |
deps = [ |
| 258 |
":Core", |
| 259 |
":DataFormattersHeaders", |
| 260 |
":Expression", |
| 261 |
":Headers", |
| 262 |
":InterpreterHeaders", |
| 263 |
":SymbolHeaders", |
| 264 |
":TargetHeaders", |
| 265 |
":Utility", |
| 266 |
"//llvm:Support", |
| 267 |
], |
| 268 |
) |
| 269 |
|
| 270 |
cc_library( |
| 271 |
name = "DataFormatters", |
| 272 |
srcs = glob(["source/DataFormatters/**/*.cpp"]), |
| 273 |
hdrs = glob(["include/lldb/DataFormatters/**/*.h"]), |
| 274 |
strip_include_prefix = "include", |
| 275 |
deps = [ |
| 276 |
":CoreHeaders", |
| 277 |
":Headers", |
| 278 |
":InterpreterHeaders", |
| 279 |
":SymbolHeaders", |
| 280 |
":TargetHeaders", |
| 281 |
":Utility", |
| 282 |
"//llvm:Support", |
| 283 |
], |
| 284 |
) |
| 285 |
|
| 286 |
cc_library( |
| 287 |
name = "Expression", |
| 288 |
srcs = glob(["source/Expression/**/*.cpp"]), |
| 289 |
hdrs = glob(["include/lldb/Expression/**/*.h"]) + [":lldb-sbapi-dwarf-enums"], |
| 290 |
strip_include_prefix = "include", |
| 291 |
deps = [ |
| 292 |
":Core", |
| 293 |
":Headers", |
| 294 |
":Host", |
| 295 |
":InterpreterHeaders", |
| 296 |
":SymbolHeaders", |
| 297 |
":TargetHeaders", |
| 298 |
":Utility", |
| 299 |
"//lldb/source/Plugins:PluginSymbolFileDWARFHeaders", |
| 300 |
"//llvm:BinaryFormat", |
| 301 |
"//llvm:Core", |
| 302 |
"//llvm:DebugInfoDWARF", |
| 303 |
"//llvm:ExecutionEngine", |
| 304 |
"//llvm:Support", |
| 305 |
], |
| 306 |
) |
| 307 |
|
| 308 |
cc_library( |
| 309 |
name = "Initialization", |
| 310 |
srcs = glob(["source/Initialization/**/*.cpp"]), |
| 311 |
hdrs = glob(["include/lldb/Initialization/**/*.h"]), |
| 312 |
strip_include_prefix = "include", |
| 313 |
deps = [ |
| 314 |
":Core", |
| 315 |
":Headers", |
| 316 |
":Host", |
| 317 |
":TargetHeaders", |
| 318 |
":Utility", |
| 319 |
":Version", |
| 320 |
"//lldb/source/Plugins:PluginProcessGDBRemote", |
| 321 |
"//lldb/source/Plugins:PluginProcessPOSIX", |
| 322 |
"//llvm:Support", |
| 323 |
], |
| 324 |
) |
| 325 |
|
| 326 |
gentbl_cc_library( |
| 327 |
name = "InterpreterProperties", |
| 328 |
strip_include_prefix = "source/Interpreter", |
| 329 |
tbl_outs = [ |
| 330 |
( |
| 331 |
["-gen-lldb-property-defs"], |
| 332 |
"source/Interpreter/InterpreterProperties.inc", |
| 333 |
), |
| 334 |
( |
| 335 |
["-gen-lldb-property-enum-defs"], |
| 336 |
"source/Interpreter/InterpreterPropertiesEnum.inc", |
| 337 |
), |
| 338 |
], |
| 339 |
tblgen = ":lldb-tblgen", |
| 340 |
td_file = "source/Interpreter/InterpreterProperties.td", |
| 341 |
deps = [":CoreTdFiles"], |
| 342 |
) |
| 343 |
|
| 344 |
cc_library( |
| 345 |
name = "APIHeaders", |
| 346 |
hdrs = glob(["include/lldb/API/**/*.h"]), |
| 347 |
strip_include_prefix = "include", |
| 348 |
) |
| 349 |
|
| 350 |
cc_library( |
| 351 |
name = "InterpreterHeaders", |
| 352 |
hdrs = glob(["include/lldb/Interpreter/**/*.h"]), |
| 353 |
strip_include_prefix = "include", |
| 354 |
deps = [":APIHeaders"], |
| 355 |
) |
| 356 |
|
| 357 |
cc_library( |
| 358 |
name = "BreakpointHeaders", |
| 359 |
hdrs = glob(["include/lldb/Breakpoint/**/*.h"]), |
| 360 |
strip_include_prefix = "include", |
| 361 |
) |
| 362 |
|
| 363 |
cc_library( |
| 364 |
name = "ExpressionHeaders", |
| 365 |
hdrs = glob(["include/lldb/Expression/**/*.h"]) + [":lldb-sbapi-dwarf-enums"], |
| 366 |
strip_include_prefix = "include", |
| 367 |
deps = ["//llvm:ExecutionEngine"], |
| 368 |
) |
| 369 |
|
| 370 |
cc_library( |
| 371 |
name = "DataFormattersHeaders", |
| 372 |
hdrs = glob(["include/lldb/DataFormatters/**/*.h"]), |
| 373 |
strip_include_prefix = "include", |
| 374 |
) |
| 375 |
|
| 376 |
cc_library( |
| 377 |
name = "Interpreter", |
| 378 |
srcs = glob(["source/Interpreter/**/*.cpp"]), |
| 379 |
deps = [ |
| 380 |
":API", |
| 381 |
":Commands", |
| 382 |
":Core", |
| 383 |
":DataFormatters", |
| 384 |
":Headers", |
| 385 |
":Host", |
| 386 |
":InterpreterHeaders", |
| 387 |
":InterpreterProperties", |
| 388 |
":SymbolHeaders", |
| 389 |
":TargetHeaders", |
| 390 |
":Utility", |
| 391 |
"//llvm:Support", |
| 392 |
], |
| 393 |
) |
| 394 |
|
| 395 |
td_library( |
| 396 |
name = "CommandsTdFiles", |
| 397 |
srcs = glob(["source/Commands/**/*.td"]), |
| 398 |
) |
| 399 |
|
| 400 |
gentbl_cc_library( |
| 401 |
name = "CommandOptions", |
| 402 |
strip_include_prefix = "source/Commands", |
| 403 |
tbl_outs = [ |
| 404 |
( |
| 405 |
["-gen-lldb-option-defs"], |
| 406 |
"source/Commands/CommandOptions.inc", |
| 407 |
), |
| 408 |
], |
| 409 |
tblgen = ":lldb-tblgen", |
| 410 |
td_file = "source/Commands/Options.td", |
| 411 |
deps = [":CommandsTdFiles"], |
| 412 |
) |
| 413 |
|
| 414 |
cc_library( |
| 415 |
name = "Commands", |
| 416 |
srcs = glob(["source/Commands/**/*.cpp"]), |
| 417 |
hdrs = glob(["source/Commands/**/*.h"]), |
| 418 |
strip_include_prefix = "source", |
| 419 |
deps = [ |
| 420 |
":Breakpoint", |
| 421 |
":CommandOptions", |
| 422 |
":Core", |
| 423 |
":DataFormatters", |
| 424 |
":Expression", |
| 425 |
":Headers", |
| 426 |
":Host", |
| 427 |
":InterpreterHeaders", |
| 428 |
":SymbolHeaders", |
| 429 |
":Target", |
| 430 |
":TargetHeaders", |
| 431 |
":Utility", |
| 432 |
":Version", |
| 433 |
"//clang:codegen", |
| 434 |
"//clang:frontend", |
| 435 |
"//llvm:Support", |
| 436 |
], |
| 437 |
) |
| 438 |
|
| 439 |
cc_library( |
| 440 |
name = "SymbolHeaders", |
| 441 |
hdrs = glob(["include/lldb/Symbol/**/*.h"]), |
| 442 |
strip_include_prefix = "include", |
| 443 |
) |
| 444 |
|
| 445 |
cc_library( |
| 446 |
name = "Symbol", |
| 447 |
srcs = glob(["source/Symbol/**/*.cpp"]), |
| 448 |
deps = [ |
| 449 |
":Core", |
| 450 |
":Expression", |
| 451 |
":Headers", |
| 452 |
":Host", |
| 453 |
":SymbolHeaders", |
| 454 |
":TargetHeaders", |
| 455 |
":Utility", |
| 456 |
":UtilityPrivateHeaders", |
| 457 |
"//llvm:DebugInfo", |
| 458 |
"//llvm:DebugInfoDWARF", |
| 459 |
"//llvm:Support", |
| 460 |
], |
| 461 |
) |
| 462 |
|
| 463 |
cc_library( |
| 464 |
name = "HostMacOSXHeaders", |
| 465 |
hdrs = glob([ |
| 466 |
"include/lldb/Host/*.h", |
| 467 |
"include/lldb/Host/macosx/*.h", |
| 468 |
"include/lldb/Host/posix/*.h", |
| 469 |
]), |
| 470 |
strip_include_prefix = "include", |
| 471 |
deps = [":Utility"], |
| 472 |
) |
| 473 |
|
| 474 |
cc_library( |
| 475 |
name = "HostMacOSXPrivateHeaders", |
| 476 |
hdrs = glob([ |
| 477 |
"source/Host/macosx/cfcpp/*.h", |
| 478 |
"source/Host/macosx/objcxx/*.h", |
| 479 |
]), |
| 480 |
strip_include_prefix = "source", |
| 481 |
tags = ["nobuildkite"], |
| 482 |
target_compatible_with = select({ |
| 483 |
"@platforms//os:macos": [], |
| 484 |
"//conditions:default": ["@platforms//:incompatible"], |
| 485 |
}), |
| 486 |
deps = [":Utility"], |
| 487 |
) |
| 488 |
|
| 489 |
objc_library( |
| 490 |
name = "HostMacOSXObjCXX", |
| 491 |
srcs = glob([ |
| 492 |
"source/Host/macosx/objcxx/*.mm", |
| 493 |
]), |
| 494 |
copts = OBJCPP_COPTS, |
| 495 |
tags = ["nobuildkite"], |
| 496 |
target_compatible_with = select({ |
| 497 |
"@platforms//os:macos": [], |
| 498 |
"//conditions:default": ["@platforms//:incompatible"], |
| 499 |
}), |
| 500 |
deps = [ |
| 501 |
":Headers", |
| 502 |
":HostMacOSXHeaders", |
| 503 |
":HostMacOSXPrivateHeaders", |
| 504 |
":Utility", |
| 505 |
"//llvm:Support", |
| 506 |
"//llvm:TargetParser", |
| 507 |
], |
| 508 |
) |
| 509 |
|
| 510 |
cc_library( |
| 511 |
name = "Host", |
| 512 |
srcs = glob([ |
| 513 |
"source/Host/common/**/*.cpp", |
| 514 |
]) + select({ |
| 515 |
"@platforms//os:linux": glob( |
| 516 |
[ |
| 517 |
"source/Host/posix/**/*.cpp", |
| 518 |
"source/Host/linux/**/*.cpp", |
| 519 |
], |
| 520 |
exclude = ["source/Host/linux/android/**/*.cpp"], |
| 521 |
), |
| 522 |
"@platforms//os:macos": glob( |
| 523 |
[ |
| 524 |
"source/Host/macosx/cfcpp/*.cpp", |
| 525 |
"source/Host/posix/**/*.cpp", |
| 526 |
], |
| 527 |
), |
| 528 |
}), |
| 529 |
hdrs = [":ConfigHeader"] + glob([ |
| 530 |
"include/lldb/Host/*.h", |
| 531 |
"include/lldb/Host/common/*.h", |
| 532 |
]) + select({ |
| 533 |
"@platforms//os:macos": glob([ |
| 534 |
"include/lldb/Host/macosx/*.h", |
| 535 |
"include/lldb/Host/posix/*.h", |
| 536 |
]), |
| 537 |
"@platforms//os:linux": glob([ |
| 538 |
"include/lldb/Host/linux/*.h", |
| 539 |
"include/lldb/Host/posix/*.h", |
| 540 |
]), |
| 541 |
}), |
| 542 |
# TODO: Move this to Config library when https://github.com/bazelbuild/bazel/issues/21884 is fixed |
| 543 |
linkopts = select({ |
| 544 |
"@platforms//os:macos": [ |
| 545 |
"-lcompression", |
| 546 |
"-lxml2", |
| 547 |
"-Wl,-framework,CoreServices", |
| 548 |
"-Wl,-framework,Security", |
| 549 |
], |
| 550 |
"//conditions:default": [], |
| 551 |
}) + select({ |
| 552 |
":curses_enabled": [ |
| 553 |
"-lcurses", |
| 554 |
"-lpanel", |
| 555 |
], |
| 556 |
"//conditions:default": [], |
| 557 |
}) + select({ |
| 558 |
":libedit_enabled": [ |
| 559 |
"-ledit", |
| 560 |
], |
| 561 |
"//conditions:default": [], |
| 562 |
}), |
| 563 |
strip_include_prefix = "include", |
| 564 |
deps = [ |
| 565 |
":Headers", |
| 566 |
":Utility", |
| 567 |
"//llvm:Object", |
| 568 |
"//llvm:Support", |
| 569 |
"//llvm:TargetParser", |
| 570 |
"//llvm:config", |
| 571 |
] + select({ |
| 572 |
"@platforms//os:macos": [ |
| 573 |
":HostMacOSXObjCXX", |
| 574 |
":HostMacOSXPrivateHeaders", |
| 575 |
], |
| 576 |
"//conditions:default": [], |
| 577 |
}), |
| 578 |
) |
| 579 |
|
| 580 |
td_library( |
| 581 |
name = "CoreTdFiles", |
| 582 |
srcs = glob([ |
| 583 |
"source/Core/**/*.td", |
| 584 |
"include/lldb/Core/*.td", |
| 585 |
]), |
| 586 |
) |
| 587 |
|
| 588 |
gentbl_cc_library( |
| 589 |
name = "CoreProperties", |
| 590 |
strip_include_prefix = "source/Core", |
| 591 |
tbl_outs = [ |
| 592 |
( |
| 593 |
["-gen-lldb-property-defs"], |
| 594 |
"source/Core/CoreProperties.inc", |
| 595 |
), |
| 596 |
( |
| 597 |
["-gen-lldb-property-enum-defs"], |
| 598 |
"source/Core/CorePropertiesEnum.inc", |
| 599 |
), |
| 600 |
], |
| 601 |
tblgen = ":lldb-tblgen", |
| 602 |
td_file = "source/Core/CoreProperties.td", |
| 603 |
deps = [":CoreTdFiles"], |
| 604 |
) |
| 605 |
|
| 606 |
cc_library( |
| 607 |
name = "CoreHeaders", |
| 608 |
hdrs = glob(["include/lldb/Core/**/*.h"]), |
| 609 |
strip_include_prefix = "include", |
| 610 |
deps = [ |
| 611 |
":BreakpointHeaders", |
| 612 |
":CoreProperties", |
| 613 |
":DataFormattersHeaders", |
| 614 |
":ExpressionHeaders", |
| 615 |
":Host", |
| 616 |
":InterpreterHeaders", |
| 617 |
":SymbolHeaders", |
| 618 |
":TargetHeaders", |
| 619 |
":Utility", |
| 620 |
"//clang:driver", |
| 621 |
"//llvm:Demangle", |
| 622 |
"//llvm:Support", |
| 623 |
"//llvm:TargetParser", |
| 624 |
], |
| 625 |
) |
| 626 |
|
| 627 |
cc_library( |
| 628 |
name = "Core", |
| 629 |
srcs = glob(["source/Core/**/*.cpp"]), |
| 630 |
hdrs = glob(["include/lldb/Core/**/*.h"]), |
| 631 |
strip_include_prefix = "include", |
| 632 |
deps = [ |
| 633 |
":BreakpointHeaders", |
| 634 |
":CoreHeaders", |
| 635 |
":CoreProperties", |
| 636 |
":DataFormattersHeaders", |
| 637 |
":ExpressionHeaders", |
| 638 |
":Headers", |
| 639 |
":Host", |
| 640 |
":InterpreterHeaders", |
| 641 |
":SymbolHeaders", |
| 642 |
":TargetHeaders", |
| 643 |
":Utility", |
| 644 |
"//clang:driver", |
| 645 |
"//lldb/source/Plugins:PluginCPlusPlusLanguageHeaders", |
| 646 |
"//lldb/source/Plugins:PluginObjCLanguageHeaders", |
| 647 |
"//llvm:Demangle", |
| 648 |
"//llvm:Support", |
| 649 |
"//llvm:TargetParser", |
| 650 |
], |
| 651 |
) |
| 652 |
|
| 653 |
gentbl_cc_library( |
| 654 |
name = "TargetProperties", |
| 655 |
strip_include_prefix = "source/Target", |
| 656 |
tbl_outs = [ |
| 657 |
( |
| 658 |
["-gen-lldb-property-defs"], |
| 659 |
"source/Target/TargetProperties.inc", |
| 660 |
), |
| 661 |
( |
| 662 |
["-gen-lldb-property-enum-defs"], |
| 663 |
"source/Target/TargetPropertiesEnum.inc", |
| 664 |
), |
| 665 |
], |
| 666 |
tblgen = ":lldb-tblgen", |
| 667 |
td_file = "source/Target/TargetProperties.td", |
| 668 |
deps = [":CoreTdFiles"], |
| 669 |
) |
| 670 |
|
| 671 |
cc_library( |
| 672 |
name = "AppleArm64ExceptionClass", |
| 673 |
hdrs = ["include/lldb/Target/AppleArm64ExceptionClass.def"], |
| 674 |
strip_include_prefix = "include/lldb/Target", |
| 675 |
) |
| 676 |
|
| 677 |
cc_library( |
| 678 |
name = "TargetHeaders", |
| 679 |
hdrs = glob(["include/lldb/Target/**/*.h"]), |
| 680 |
strip_include_prefix = "include", |
| 681 |
deps = [":AppleArm64ExceptionClass"], |
| 682 |
) |
| 683 |
|
| 684 |
cc_library( |
| 685 |
name = "Target", |
| 686 |
srcs = glob(["source/Target/**/*.cpp"]), |
| 687 |
deps = [ |
| 688 |
":BreakpointHeaders", |
| 689 |
":Core", |
| 690 |
":DataFormattersHeaders", |
| 691 |
":ExpressionHeaders", |
| 692 |
":Headers", |
| 693 |
":Host", |
| 694 |
":InterpreterHeaders", |
| 695 |
":Symbol", |
| 696 |
":SymbolHeaders", |
| 697 |
":TargetHeaders", |
| 698 |
":TargetProperties", |
| 699 |
":Utility", |
| 700 |
"//clang:codegen", |
| 701 |
"//lldb/source/Plugins:PluginProcessUtility", |
| 702 |
"//llvm:BinaryFormat", |
| 703 |
"//llvm:MC", |
| 704 |
"//llvm:Support", |
| 705 |
], |
| 706 |
) |
| 707 |
|
| 708 |
cc_library( |
| 709 |
name = "Headers", |
| 710 |
hdrs = glob(["include/lldb/lldb-*.h"]) + [ |
| 711 |
"include/lldb/Symbol/SaveCoreOptions.h", |
| 712 |
], |
| 713 |
strip_include_prefix = "include", |
| 714 |
) |
| 715 |
|
| 716 |
cc_library( |
| 717 |
name = "UtilityPrivateHeaders", |
| 718 |
hdrs = glob(["source/Utility/**/*.h"]), |
| 719 |
strip_include_prefix = "source", |
| 720 |
deps = [":Headers"], |
| 721 |
) |
| 722 |
|
| 723 |
cc_library( |
| 724 |
name = "Utility", |
| 725 |
srcs = glob(["source/Utility/**/*.cpp"]), |
| 726 |
hdrs = glob(["include/lldb/Utility/**/*.h"]), |
| 727 |
strip_include_prefix = "include", |
| 728 |
deps = [ |
| 729 |
":Headers", |
| 730 |
":UtilityPrivateHeaders", |
| 731 |
"//llvm:BinaryFormat", |
| 732 |
"//llvm:Support", |
| 733 |
"//llvm:TargetParser", |
| 734 |
"//llvm:config", |
| 735 |
], |
| 736 |
) |
| 737 |
|
| 738 |
genrule( |
| 739 |
name = "gen_exports_file_linux", |
| 740 |
srcs = ["//lldb:source/API/liblldb-private.exports"], |
| 741 |
outs = ["exports_linux.txt"], |
| 742 |
cmd = """ |
| 743 |
cat > $(OUTS) <<EOF |
| 744 |
{ |
| 745 |
global: |
| 746 |
$$(sed 's/$$/;/g' $(SRCS)) |
| 747 |
}; |
| 748 |
EOF |
| 749 |
""", |
| 750 |
) |
| 751 |
|
| 752 |
genrule( |
| 753 |
name = "gen_exports_file_macos", |
| 754 |
srcs = ["//lldb:source/API/liblldb-private.exports"], |
| 755 |
outs = ["exports_macos.txt"], |
| 756 |
cmd = "sed 's/^/_/g' $(SRCS) > $(OUTS)", |
| 757 |
) |
| 758 |
|
| 759 |
# Create a shared library using linkshared=True for liblldb. This uses |
| 760 |
# cc_binary instead of cc_shared_library since the latter expects you to |
| 761 |
# re-export all transitive dependencies vs them being relinked into other |
| 762 |
# binaries. |
| 763 |
cc_binary( |
| 764 |
name = "lldb{}".format(PACKAGE_VERSION), |
| 765 |
additional_linker_inputs = select({ |
| 766 |
"@platforms//os:linux": [ |
| 767 |
":gen_exports_file_linux", |
| 768 |
], |
| 769 |
"@platforms//os:macos": [ |
| 770 |
":gen_exports_file_macos", |
| 771 |
], |
| 772 |
"//conditions:default": [], |
| 773 |
}), |
| 774 |
linkopts = select({ |
| 775 |
"@platforms//os:linux": [ |
| 776 |
"-Wl,--export-dynamic-symbol-list=$(location :gen_exports_file_linux)", |
| 777 |
], |
| 778 |
"@platforms//os:macos": [ |
| 779 |
"-Wl,-exported_symbols_list,$(location :gen_exports_file_macos)", |
| 780 |
], |
| 781 |
"//conditions:default": [], |
| 782 |
}), |
| 783 |
linkshared = True, |
| 784 |
deps = [ |
| 785 |
":API", |
| 786 |
":Interpreter", |
| 787 |
], |
| 788 |
) |
| 789 |
|
| 790 |
# cc_binary targets using linkshared=True to build a shared library cannot be |
| 791 |
# imported directly and instead need to be referenced indirectly through |
| 792 |
# cc_import |
| 793 |
cc_import( |
| 794 |
name = "liblldb.wrapper", |
| 795 |
shared_library = "lldb{}".format(PACKAGE_VERSION), |
| 796 |
) |
| 797 |
|
| 798 |
gentbl_cc_library( |
| 799 |
name = "lldb_options_inc_gen", |
| 800 |
strip_include_prefix = ".", |
| 801 |
tbl_outs = [( |
| 802 |
["-gen-opt-parser-defs"], |
| 803 |
"Options.inc", |
| 804 |
)], |
| 805 |
tblgen = "//llvm:llvm-tblgen", |
| 806 |
td_file = "tools/driver/Options.td", |
| 807 |
deps = ["//llvm:OptParserTdFiles"], |
| 808 |
) |
| 809 |
|
| 810 |
alias( |
| 811 |
name = "gdb-server", |
| 812 |
actual = select({ |
| 813 |
"@platforms//os:macos": ":debugserver", |
| 814 |
"//conditions:default": ":lldb-server", |
| 815 |
}), |
| 816 |
) |
| 817 |
|
| 818 |
cc_binary( |
| 819 |
name = "lldb", |
| 820 |
srcs = glob([ |
| 821 |
"tools/driver/*.cpp", |
| 822 |
"tools/driver/*.h", |
| 823 |
]), |
| 824 |
deps = [ |
| 825 |
":APIHeaders", |
| 826 |
":Host", |
| 827 |
":liblldb.wrapper", |
| 828 |
":lldb_options_inc_gen", |
| 829 |
"//llvm:Option", |
| 830 |
"//llvm:Support", |
| 831 |
], |
| 832 |
) |
| 833 |
|
| 834 |
cc_library( |
| 835 |
name = "DebugServerCommonMacOSXHeaders", |
| 836 |
hdrs = glob(["tools/debugserver/source/MacOSX/**/*.h"]), |
| 837 |
strip_include_prefix = "tools/debugserver/source/MacOSX", |
| 838 |
) |
| 839 |
|
| 840 |
cc_library( |
| 841 |
name = "DebugServerCommonHeaders", |
| 842 |
hdrs = glob(["tools/debugserver/source/**/*.h"]), |
| 843 |
strip_include_prefix = "tools/debugserver/source", |
| 844 |
deps = [":DebugServerCommonMacOSXHeaders"], |
| 845 |
) |
| 846 |
|
| 847 |
objc_library( |
| 848 |
name = "DebugServerMacOSX", |
| 849 |
srcs = glob(["tools/debugserver/source/MacOSX/*.mm"]), |
| 850 |
copts = OBJCPP_COPTS, |
| 851 |
tags = ["nobuildkite"], |
| 852 |
target_compatible_with = select({ |
| 853 |
"@platforms//os:macos": [], |
| 854 |
"//conditions:default": ["@platforms//:incompatible"], |
| 855 |
}), |
| 856 |
deps = [ |
| 857 |
":DebugServerCommonHeaders", |
| 858 |
":DebugServerCommonMacOSXHeaders", |
| 859 |
], |
| 860 |
) |
| 861 |
|
| 862 |
cc_library( |
| 863 |
name = "DebugServerCommon", |
| 864 |
srcs = glob( |
| 865 |
["tools/debugserver/source/**/*.cpp"], |
| 866 |
exclude = ["tools/debugserver/source/debugserver.cpp"], |
| 867 |
), |
| 868 |
local_defines = ["LLDB_USE_OS_LOG"], |
| 869 |
tags = ["nobuildkite"], |
| 870 |
deps = [ |
| 871 |
":DebugServerCommonHeaders", |
| 872 |
":DebugServerCommonMacOSXHeaders", |
| 873 |
":DebugServerMacOSX", |
| 874 |
":Host", |
| 875 |
], |
| 876 |
) |
| 877 |
|
| 878 |
apple_genrule( |
| 879 |
name = "mach_gen", |
| 880 |
srcs = ["tools/debugserver/source/MacOSX/dbgnub-mig.defs"], |
| 881 |
outs = [ |
| 882 |
"mach_exc.h", |
| 883 |
"mach_excServer.c", |
| 884 |
"mach_excUser.c", |
| 885 |
], |
| 886 |
cmd = "mig -header $(location :mach_exc.h) -server $(location :mach_excServer.c) -user $(location :mach_excUser.c) $(SRCS)", |
| 887 |
tags = [ |
| 888 |
"manual", |
| 889 |
"nobuildkite", |
| 890 |
], |
| 891 |
target_compatible_with = select({ |
| 892 |
"@platforms//os:macos": [], |
| 893 |
"//conditions:default": ["@platforms//:incompatible"], |
| 894 |
}), |
| 895 |
) |
| 896 |
|
| 897 |
expand_template( |
| 898 |
name = "debugserver_version_gen", |
| 899 |
out = "debugserver_vers.c", |
| 900 |
substitutions = _VERSION_SUBSTITUTIONS, |
| 901 |
template = "tools/debugserver/source/debugserver_vers.c.in", |
| 902 |
) |
| 903 |
|
| 904 |
cc_binary( |
| 905 |
name = "debugserver_unsigned", |
| 906 |
srcs = [ |
| 907 |
"tools/debugserver/source/debugserver.cpp", |
| 908 |
":debugserver_version_gen", |
| 909 |
":mach_gen", |
| 910 |
], |
| 911 |
tags = ["nobuildkite"], |
| 912 |
target_compatible_with = select({ |
| 913 |
"@platforms//os:macos": [], |
| 914 |
"//conditions:default": ["@platforms//:incompatible"], |
| 915 |
}), |
| 916 |
deps = [ |
| 917 |
":DebugServerCommon", |
| 918 |
":DebugServerCommonHeaders", |
| 919 |
":DebugServerCommonMacOSXHeaders", |
| 920 |
], |
| 921 |
) |
| 922 |
|
| 923 |
apple_genrule( |
| 924 |
name = "debugserver_signed", |
| 925 |
srcs = [":debugserver_unsigned"], |
| 926 |
outs = ["debugserver"], |
| 927 |
cmd = "cp $(SRCS) $(OUTS) && xcrun codesign -f -s - --entitlements $(location tools/debugserver/resources/debugserver-macosx-entitlements.plist) $(OUTS)", |
| 928 |
tags = [ |
| 929 |
"manual", |
| 930 |
"nobuildkite", |
| 931 |
], |
| 932 |
target_compatible_with = select({ |
| 933 |
"@platforms//os:macos": [], |
| 934 |
"//conditions:default": ["@platforms//:incompatible"], |
| 935 |
}), |
| 936 |
tools = [ |
| 937 |
"tools/debugserver/resources/debugserver-macosx-entitlements.plist", |
| 938 |
], |
| 939 |
) |
| 940 |
|
| 941 |
cc_binary( |
| 942 |
name = "lldb-argdumper", |
| 943 |
srcs = glob(["tools/argdumper/*.cpp"]), |
| 944 |
deps = ["//llvm:Support"], |
| 945 |
) |
| 946 |
|
| 947 |
gentbl_cc_library( |
| 948 |
name = "lldb_server_opts_gen", |
| 949 |
strip_include_prefix = ".", |
| 950 |
tbl_outs = [( |
| 951 |
["-gen-opt-parser-defs"], |
| 952 |
"LLGSOptions.inc", |
| 953 |
)], |
| 954 |
tblgen = "//llvm:llvm-tblgen", |
| 955 |
td_file = "tools/lldb-server/LLGSOptions.td", |
| 956 |
deps = ["//llvm:OptParserTdFiles"], |
| 957 |
) |
| 958 |
|
| 959 |
cc_binary( |
| 960 |
name = "lldb-server", |
| 961 |
srcs = glob([ |
| 962 |
"tools/lldb-server/*.cpp", |
| 963 |
"tools/lldb-server/*.h", |
| 964 |
]), |
| 965 |
target_compatible_with = select({ |
| 966 |
"@platforms//os:linux": [], |
| 967 |
"@platforms//os:macos": [], |
| 968 |
# TODO: This can theoretically support more platforms, but it hasn't been tested yet |
| 969 |
"//conditions:default": ["@platforms//:incompatible"], |
| 970 |
}), |
| 971 |
deps = [ |
| 972 |
":Host", |
| 973 |
":Initialization", |
| 974 |
":Interpreter", |
| 975 |
":Utility", |
| 976 |
":Version", |
| 977 |
":lldb_server_opts_gen", |
| 978 |
"//lldb:Target", |
| 979 |
"//lldb:TargetHeaders", |
| 980 |
"//lldb/source/Plugins:PluginCPlusPlusLanguage", |
| 981 |
"//lldb/source/Plugins:PluginExpressionParserClang", |
| 982 |
"//lldb/source/Plugins:PluginInstructionARM", |
| 983 |
"//lldb/source/Plugins:PluginInstructionARM64", |
| 984 |
"//lldb/source/Plugins:PluginInstructionLoongArch", |
| 985 |
"//lldb/source/Plugins:PluginInstructionMIPS", |
| 986 |
"//lldb/source/Plugins:PluginInstructionMIPS64", |
| 987 |
"//lldb/source/Plugins:PluginInstructionRISCV", |
| 988 |
"//lldb/source/Plugins:PluginObjCLanguage", |
| 989 |
"//lldb/source/Plugins:PluginProcessGDBRemote", |
| 990 |
"//lldb/source/Plugins:PluginSymbolFileDWARF", |
| 991 |
"//lldb/source/Plugins:PluginSymbolFileNativePDB", |
| 992 |
"//lldb/source/Plugins:PluginSymbolFilePDB", |
| 993 |
"//lldb/source/Plugins:PluginTypeSystemClang", |
| 994 |
"//llvm:Option", |
| 995 |
"//llvm:Support", |
| 996 |
] + select({ |
| 997 |
"@platforms//os:linux": [ |
| 998 |
"//lldb/source/Plugins:PluginObjectFileELF", |
| 999 |
"//lldb/source/Plugins:PluginProcessLinux", |
| 1000 |
], |
| 1001 |
"@platforms//os:macos": [ |
| 1002 |
"//lldb/source/Plugins:PluginObjectFileMachO", |
| 1003 |
], |
| 1004 |
"//conditions:default": [], |
| 1005 |
}), |
| 1006 |
) |