From d6f840609b50baa048d0bcef6d82eb9e75c9483e Mon Sep 17 00:00:00 2001 From: Todd Fiala Date: Wed, 14 Oct 2015 14:52:15 +0000 Subject: cmake: provide flag that enables 'log enable --stack' to provide useful file/function info on POSIX systems Adding the following flag to a cmake line: -DLLDB_EXPORT_ALL_SYMBOLS=TRUE will cause all symbols to be exported from liblldb. This enables the llvm backtrace mechanism to see and report backtrace symbols properly when using (lldb) log enable --stack ... Prior to this change, only the SB API symbols would show up on Linux and other systems that use a public-symbols-based backtrace lookup mechanism. log enable --stack ... is a very handy, quick way to understand the flow of how some log lines are getting hit within lldb without having to hook up a top-level debugger over your current debug session. llvm-svn: 250299 --- lldb/source/API/CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lldb/source/API') diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index 271afa9c9a8..06a26e17c92 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -82,7 +82,21 @@ set_target_properties(liblldb ) if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") - add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports) + if (NOT LLDB_EXPORT_ALL_SYMBOLS) + # If we're not exporting all symbols, we'll want to explicitly set + # the exported symbols here. This prevents 'log enable --stack ...' + # from working on some systems but limits the liblldb size. + MESSAGE("-- Symbols (liblldb): only exporting liblldb.exports symbols") + add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports) + else() + # Don't use an explicit export. Instead, tell the linker to + # export all symbols. + MESSAGE("-- Symbols (liblldb): exporting all symbols") + # Darwin linker doesn't need this extra step. + if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + lldb_append_link_flags(liblldb "-Wl,--export-dynamic") + endif() + endif() endif() if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) -- cgit v1.2.3