[llvm] Default to LLDB debugger tuning for shared library builds (PR #83083)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 15:59:40 PST 2024


================
@@ -1061,6 +1061,17 @@ if (LLVM_USE_SPLIT_DWARF AND
   endif()
 endif()
 
+if (BUILD_SHARED_LIBS AND CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
+    ((uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") OR
+     (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")))
+  # When using a shared libraries build, tune the debug info output for LLDB
+  # (which enables standalone debug info) since otherwise LLDB users will not be
+  # able to print types from other shared libraries (e.g. SmallVector printing
+  # will only work inside libLLVMSupport).
+  # See https://github.com/llvm/llvm-project/issues/60994#issuecomment-1447337360
+  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-glldb>)
+endif()
----------------
dwblaikie wrote:

I don't think we should do this by default. gdb is still pretty dominant outside Apple platforms and it'd be unfortunate to pay the cost for every release, etc.

I think lldb users on those platforms should put `-glldb` in themselves, or perhaps we can have a CMake flag for it to make it a bit clearer/easier.

But, yeah, I basically don't think a debug build of LLVM on a non-Apple platform should work out-of-the-box for LLDB - LLDB's bug here is just too severe to have everyone else workaround it by default. (the same sort of reason I wouldn't change Clang's default on non-Apple platforms to -glldb).

https://github.com/llvm/llvm-project/pull/83083


More information about the llvm-commits mailing list