Re: [Lldb-commits] [PATCH] D22463: [RFC] Moving to GitHub Proposal: NOT DECISION!
delcypher added a subscriber: delcypher. Comment at: docs/Proposals/GitHub.rst:102 @@ +101,3 @@ + +How will the new workflow look like +=== s/How will/What will/ Comment at: docs/Proposals/GitHub.rst:136 @@ +135,3 @@ + +We will need additional server hooks to avoid non-fast-forwards commits (ex. +merges, forced pushes, etc) in order to keep the linearity of the history. @rengolin : I know GitHub enterprise has a "protected branch" feature to prevent forced pushed ( https://github.com/blog/2051-protected-branches-and-required-status-checks ). You might want to speak to them to see if they can offer us that feature. I think there's a limited support to do a merge as a squash and rebase too ( https://github.com/blog/2141-squash-your-commits ) Comment at: docs/Proposals/GitHub.rst:233 @@ +232,3 @@ + +10. Collect peoples GitHub account information, adding them to the project. +11. Switch SVN repository to read-only and allow pushes to the GitHub repository. GitHub organizations support the notion of teams which can each have different permissions (for example you'll want to make sure only the right people have admin access and give the rest write/read access). You could also make a team per project so that write access in one project does not give write access to another. I think it would be good to decide on how teams will be organized and state this in the document. https://reviews.llvm.org/D22463 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add frame recognizer for __builtin_verbose_trap (PR #80368)
https://github.com/delcypher requested changes to this pull request. Looks pretty good. I had a few minor comments https://github.com/llvm/llvm-project/pull/80368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add frame recognizer for __builtin_verbose_trap (PR #80368)
@@ -0,0 +1,122 @@ +#include "lldb/Target/VerboseTrapFrameRecognizer.h" + +#include "lldb/Core/Module.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/StackFrameRecognizer.h" +#include "lldb/Target/Target.h" + +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" + +#include "clang/CodeGen/ModuleBuilder.h" + +using namespace llvm; +using namespace lldb; +using namespace lldb_private; + +VerboseTrapRecognizedStackFrame::VerboseTrapRecognizedStackFrame( +StackFrameSP most_relevant_frame_sp, std::string stop_desc) +: m_most_relevant_frame(most_relevant_frame_sp) { + m_stop_desc = std::move(stop_desc); +} + +lldb::RecognizedStackFrameSP +VerboseTrapFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame_sp) { + if (frame_sp->GetFrameIndex()) +return {}; + + ThreadSP thread_sp = frame_sp->GetThread(); + ProcessSP process_sp = thread_sp->GetProcess(); + + StackFrameSP most_relevant_frame_sp = thread_sp->GetStackFrameAtIndex(1); delcypher wrote: Is there anyway for there to not be a stack frame at index 1? If that's possible could we bail out early so we don't crash/have bad behavior? https://github.com/llvm/llvm-project/pull/80368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add frame recognizer for __builtin_verbose_trap (PR #80368)
@@ -0,0 +1,122 @@ +#include "lldb/Target/VerboseTrapFrameRecognizer.h" + +#include "lldb/Core/Module.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/StackFrameRecognizer.h" +#include "lldb/Target/Target.h" + +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" + +#include "clang/CodeGen/ModuleBuilder.h" + +using namespace llvm; +using namespace lldb; +using namespace lldb_private; + +VerboseTrapRecognizedStackFrame::VerboseTrapRecognizedStackFrame( +StackFrameSP most_relevant_frame_sp, std::string stop_desc) +: m_most_relevant_frame(most_relevant_frame_sp) { + m_stop_desc = std::move(stop_desc); +} + +lldb::RecognizedStackFrameSP +VerboseTrapFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame_sp) { + if (frame_sp->GetFrameIndex()) +return {}; + + ThreadSP thread_sp = frame_sp->GetThread(); + ProcessSP process_sp = thread_sp->GetProcess(); + + StackFrameSP most_relevant_frame_sp = thread_sp->GetStackFrameAtIndex(1); + + if (!most_relevant_frame_sp) { +Log *log = GetLog(LLDBLog::Unwind); +LLDB_LOG( +log, +"Failed to find most relevant frame: Hit unwinding bound (1 frame)!"); +return {}; + } + + SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextEverything); + + if (!sc.block) +return {}; + + // The runtime error is set as the function name in the inlined function info + // of frame #0 by the compiler + const InlineFunctionInfo *inline_info = nullptr; + Block *inline_block = sc.block->GetContainingInlinedBlock(); + + if (!inline_block) +return {}; + + inline_info = sc.block->GetInlinedFunctionInfo(); + + if (!inline_info) +return {}; + + auto func_name = inline_info->GetName().GetStringRef(); + if (func_name.empty()) +return {}; + + static auto trap_regex = + llvm::Regex(llvm::formatv("^{0}\\$(.*)\\$(.*)$", ClangTrapPrefix).str()); + SmallVector matches; delcypher wrote: If we expect 3 matches shouldn't the stack allocation size be `3` instead of `2`? https://github.com/llvm/llvm-project/pull/80368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add frame recognizer for __builtin_verbose_trap (PR #80368)
https://github.com/delcypher edited https://github.com/llvm/llvm-project/pull/80368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
https://github.com/delcypher edited https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -673,6 +673,9 @@ option(LLVM_USE_OPROFILE option(LLVM_EXTERNALIZE_DEBUGINFO "Generate dSYM files and strip executables and libraries (Darwin Only)" OFF) +option(LLVM_ENABLE_EXPORTED_SYMBOLS delcypher wrote: We may want to rename this. The name hints that this option applies to everything but actually it only applies to executables and not libraries. E.g. `LLVM_ENABLE_TOOLS_WITH_EXPORTED_SYMBOLS` https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -654,6 +654,11 @@ enabled sub-projects. Nearly all of these variable names begin with Generate dSYM files and strip executables and libraries (Darwin Only). Defaults to OFF. +**LLVM_ENABLE_EXPORTED_SYMBOLS**:BOOL + When building executables, preserve symbol exports. Defaults to ON. + You can use this option to disable exported symbols on all executable build delcypher wrote: ```suggestion Setting this option to ``OFF`` removes exported symbols from all executables. ``` https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
https://github.com/delcypher requested changes to this pull request. Generally looks good. I have some minor nits. I'd like to see `LLVM_ENABLE_EXPORTED_SYMBOLS` renamed to avoid ambiguity. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -654,6 +654,11 @@ enabled sub-projects. Nearly all of these variable names begin with Generate dSYM files and strip executables and libraries (Darwin Only). Defaults to OFF. +**LLVM_ENABLE_EXPORTED_SYMBOLS**:BOOL + When building executables, preserve symbol exports. Defaults to ON. + You can use this option to disable exported symbols on all executable build delcypher wrote: Nit: Documentation tends not to use "You" as the subject. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -673,6 +673,9 @@ option(LLVM_USE_OPROFILE option(LLVM_EXTERNALIZE_DEBUGINFO "Generate dSYM files and strip executables and libraries (Darwin Only)" OFF) +option(LLVM_ENABLE_EXPORTED_SYMBOLS danliew-apple wrote: I'm fine with that. You could also do `LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES` which is ever so slightly shorter 🤷♂️ https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -673,6 +673,9 @@ option(LLVM_USE_OPROFILE option(LLVM_EXTERNALIZE_DEBUGINFO "Generate dSYM files and strip executables and libraries (Darwin Only)" OFF) +option(LLVM_ENABLE_EXPORTED_SYMBOLS delcypher wrote: > "tools" has a pretty specific meaning for LLVM so I think that will actually > cause more confusion (i.e. I would expect that option to apply to > llvm-dwarfdump, but not to clang). I'm personally fine with the current > concise name. I'm not exactly sure what that "specific meaning" is but I'm happy to go with something else. I think using the name "EXECUTABLE" as @cyndyishida is suggesting is consistent with the option being used in `add_llvm_executable()`. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
https://github.com/delcypher deleted https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -673,6 +673,9 @@ option(LLVM_USE_OPROFILE option(LLVM_EXTERNALIZE_DEBUGINFO "Generate dSYM files and strip executables and libraries (Darwin Only)" OFF) +option(LLVM_ENABLE_EXPORTED_SYMBOLS delcypher wrote: @JDevlieghere > "tools" has a pretty specific meaning for LLVM so I think that will actually > cause more confusion (i.e. I would expect that option to apply to > llvm-dwarfdump, but not to clang). I'm personally fine with the current > concise name. I'm not exactly sure what that "specific meaning" is but I'm happy to go with something else. I think using the name "EXECUTABLE" as @cyndyishida is suggesting is consistent with the option being used in the `add_llvm_executable()` macro. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -654,6 +654,11 @@ enabled sub-projects. Nearly all of these variable names begin with Generate dSYM files and strip executables and libraries (Darwin Only). Defaults to OFF. +**LLVM_ENABLE_EXPORTED_SYMBOLS**:BOOL + When building executables, preserve symbol exports. Defaults to ON. + You can use this option to disable exported symbols on all executable build delcypher wrote: Well if there's precedent I guess you can go either way. I'm personally not a fan but you should go with whatever you prefer. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -1029,6 +1038,11 @@ macro(add_llvm_executable name) add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} ) endif(LLVM_EXPORTED_SYMBOL_FILE) + if (NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS) delcypher wrote: Currently we silently ignore `LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES` if the linker doesn't support the flag. It would probably better to produce a fatal error to avoid an invalid configuration being used. ```cmake if (NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES) if (LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS) set_property(TARGET ${name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-no_exported_symbols") else() message(FATAL_ERROR "LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES cannot be disabled when linker does not support \" -Wl,-no_exported_symbols\"" endif() endif() ``` https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -258,15 +258,24 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32) endif() endif() - # Apple's linker complains about duplicate libraries, which CMake likes to do - # to support ELF platforms. To silence that warning, we can use - # -no_warn_duplicate_libraries, but only in versions of the linker that - # support that flag. - if(NOT LLVM_USE_LINKER AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") include(CheckLinkerFlag) -check_linker_flag(C "-Wl,-no_warn_duplicate_libraries" LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES) - else() -set(LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "") +# Linkers that support Darwin allow a setting to internalize all symbol exports, +# aiding in reducing binary size and often is applicable for executables. +check_linker_flag(C "-Wl,-no_exported_symbols" LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS) + +if (NOT LLVM_USE_LINKER) + # Apple's linker complains about duplicate libraries, which CMake likes to do + # to support ELF platforms. To silence that warning, we can use + # -no_warn_duplicate_libraries, but only in versions of the linker that + # support that flag. + check_linker_flag(C "-Wl,-no_warn_duplicate_libraries" LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES) +else() + set(LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "") delcypher wrote: Nit: This won't do anything if `LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES` is already set in the cache (e.g. from a previous configure). You can use `FORCE` to always set the value. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -258,15 +258,24 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32) endif() endif() - # Apple's linker complains about duplicate libraries, which CMake likes to do - # to support ELF platforms. To silence that warning, we can use - # -no_warn_duplicate_libraries, but only in versions of the linker that - # support that flag. - if(NOT LLVM_USE_LINKER AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") include(CheckLinkerFlag) -check_linker_flag(C "-Wl,-no_warn_duplicate_libraries" LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES) - else() -set(LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "") +# Linkers that support Darwin allow a setting to internalize all symbol exports, +# aiding in reducing binary size and often is applicable for executables. +check_linker_flag(C "-Wl,-no_exported_symbols" LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS) + +if (NOT LLVM_USE_LINKER) + # Apple's linker complains about duplicate libraries, which CMake likes to do + # to support ELF platforms. To silence that warning, we can use + # -no_warn_duplicate_libraries, but only in versions of the linker that + # support that flag. + check_linker_flag(C "-Wl,-no_warn_duplicate_libraries" LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES) +else() + set(LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "") +endif() + + else() +set(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS OFF CACHE INTERNAL "") delcypher wrote: Same here. Consider using `FORCE` https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
https://github.com/delcypher approved this pull request. LGTM. Other than the nit about not using `FORCE` to set the CMake cache variable. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -258,15 +258,24 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32) endif() endif() - # Apple's linker complains about duplicate libraries, which CMake likes to do - # to support ELF platforms. To silence that warning, we can use - # -no_warn_duplicate_libraries, but only in versions of the linker that - # support that flag. - if(NOT LLVM_USE_LINKER AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") include(CheckLinkerFlag) -check_linker_flag(C "-Wl,-no_warn_duplicate_libraries" LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES) - else() -set(LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "") +# Linkers that support Darwin allow a setting to internalize all symbol exports, +# aiding in reducing binary size and often is applicable for executables. +check_linker_flag(C "-Wl,-no_exported_symbols" LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS) + +if (NOT LLVM_USE_LINKER) + # Apple's linker complains about duplicate libraries, which CMake likes to do + # to support ELF platforms. To silence that warning, we can use + # -no_warn_duplicate_libraries, but only in versions of the linker that + # support that flag. + check_linker_flag(C "-Wl,-no_warn_duplicate_libraries" LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES) +else() + set(LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "") delcypher wrote: Oh wait. Ignore me. Using `INTERNAL` implies `FORCE`. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
@@ -258,15 +258,24 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32) endif() endif() - # Apple's linker complains about duplicate libraries, which CMake likes to do - # to support ELF platforms. To silence that warning, we can use - # -no_warn_duplicate_libraries, but only in versions of the linker that - # support that flag. - if(NOT LLVM_USE_LINKER AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") include(CheckLinkerFlag) -check_linker_flag(C "-Wl,-no_warn_duplicate_libraries" LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES) - else() -set(LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "") +# Linkers that support Darwin allow a setting to internalize all symbol exports, +# aiding in reducing binary size and often is applicable for executables. +check_linker_flag(C "-Wl,-no_exported_symbols" LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS) + +if (NOT LLVM_USE_LINKER) + # Apple's linker complains about duplicate libraries, which CMake likes to do + # to support ELF platforms. To silence that warning, we can use + # -no_warn_duplicate_libraries, but only in versions of the linker that + # support that flag. + check_linker_flag(C "-Wl,-no_warn_duplicate_libraries" LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES) +else() + set(LLVM_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "") +endif() + + else() +set(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS OFF CACHE INTERNAL "") delcypher wrote: Ignore this suggestion. `INTERNAL` implies `FORCE`. https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
https://github.com/delcypher edited https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
https://github.com/delcypher edited https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
https://github.com/delcypher edited https://github.com/llvm/llvm-project/pull/87684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add frame recognizer for __builtin_verbose_trap (PR #80368)
@@ -0,0 +1,98 @@ +#include "lldb/Target/VerboseTrapFrameRecognizer.h" + +#include "lldb/Core/Module.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" + +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" + +using namespace llvm; +using namespace lldb; +using namespace lldb_private; + +VerboseTrapRecognizedStackFrame::VerboseTrapRecognizedStackFrame( +StackFrameSP most_relevant_frame_sp, std::string stop_desc) +: m_most_relevant_frame(most_relevant_frame_sp) { + m_stop_desc = std::move(stop_desc); +} + +lldb::RecognizedStackFrameSP +VerboseTrapFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame_sp) { + if (frame_sp->GetFrameIndex()) +return {}; + + ThreadSP thread_sp = frame_sp->GetThread(); + ProcessSP process_sp = thread_sp->GetProcess(); + + StackFrameSP most_relevant_frame_sp = thread_sp->GetStackFrameAtIndex(1); + + if (!most_relevant_frame_sp) { +Log *log = GetLog(LLDBLog::Unwind); +LLDB_LOG( +log, +"Failed to find most relevant frame: Hit unwinding bound (1 frame)!"); +return {}; + } + + SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextEverything); + + if (!sc.block) +return {}; + + // The runtime error is set as the function name in the inlined function info + // of frame #0 by the compiler + const InlineFunctionInfo *inline_info = nullptr; + Block *inline_block = sc.block->GetContainingInlinedBlock(); + + if (!inline_block) +return {}; + + inline_info = sc.block->GetInlinedFunctionInfo(); + + if (!inline_info) +return {}; + + auto error_message = inline_info->GetName().GetString(); + if (error_message.empty()) +return {}; + + // Replaces "__llvm_verbose_trap: " with "Runtime Error: " + auto space_position = error_message.find(" "); + if (space_position == std::string::npos) { +Log *log = GetLog(LLDBLog::Unwind); +LLDB_LOGF(log, + "Unexpected function name format. Expected ': " + "' but got: '%s'.", + error_message.c_str()); + +return {}; + } + + error_message.replace(0, space_position, "Runtime Error:"); + + return lldb::RecognizedStackFrameSP(new VerboseTrapRecognizedStackFrame( + most_relevant_frame_sp, std::move(error_message))); +} + +lldb::StackFrameSP VerboseTrapRecognizedStackFrame::GetMostRelevantFrame() { + return m_most_relevant_frame; +} + +namespace lldb_private { + +void RegisterVerboseTrapFrameRecognizer(Process &process) { + RegularExpressionSP module_regex_sp = nullptr; + RegularExpressionSP symbol_regex_sp( + new RegularExpression("^__llvm_verbose_trap: ")); delcypher wrote: Rather than hard coding the name should we be getting it from a header file vended by Clang? I mentioned this in the corresponding Clang review [here](https://github.com/llvm/llvm-project/pull/79230#discussion_r1475241985). This wouldn't need to be anything sophisticated. Just a header file under `include/clang/CodeGen` that is something like ``` #define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap" ``` and then from LLDB that would be something like: ``` new RegularExpression("^" CLANG_VERBOSE_TRAP_PREFIX ": ") ``` That way there is a single source of truth for the name used. https://github.com/llvm/llvm-project/pull/80368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add frame recognizer for __builtin_verbose_trap (PR #80368)
@@ -0,0 +1,9 @@ +# RUN: %clang_host -g -O0 %S/Inputs/verbose_trap.cpp -o %t.out +# RUN: %lldb -b -s %s %t.out | FileCheck %s +run +# CHECK: thread #{{.*}}stop reason = Runtime Error: Function is not implemented delcypher wrote: `Runtime Error:` is pretty generic. Is there any reason we aren't mentioning that a trap was hit? https://github.com/llvm/llvm-project/pull/80368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 55a363f - [LLDB] Expose several methods in SBWatchpoint
Author: Dan Liew Date: 2023-03-01T11:15:05-08:00 New Revision: 55a363fea18b20a81e8ebb9518997a3bda602f32 URL: https://github.com/llvm/llvm-project/commit/55a363fea18b20a81e8ebb9518997a3bda602f32 DIFF: https://github.com/llvm/llvm-project/commit/55a363fea18b20a81e8ebb9518997a3bda602f32.diff LOG: [LLDB] Expose several methods in SBWatchpoint This patch adds the following methods: * `GetType()` * `GetWatchValueKind()` * `GetWatchSpec()` * `IsWatchingReads()` * `IsWatchingWrites()` These mostly expose methods that `lldb_private::Watchpoint` already had. Tests are included that exercise these new methods. The motivation for exposing these are as follows: * `GetType()` - With this information and the address from a watchpoint it is now possible to construct an SBValue from an SBWatchpoint. Previously this wasn't possible. The included test case illustrates doing this. * `GetWatchValueKind()` - This allows the caller to determine whether the watchpoint is a variable watchpoint or an expression watchpoint. A new enum (`WatchpointValueKind`) has been introduced to represent the return values. Unfortunately the name `WatchpointKind` was already taken. * `GetWatchSpec()` - This allows (at least for variable watchpoints) to use a sensible name for SBValues created from an SBWatchpoint. * `IsWatchingReads()` - This allow checking if a watchpoint is monitoring read accesses. * `IsWatchingWRites()` - This allow checking if a watchpoint is monitoring write accesses. rdar://105606978 Reviewers: jingham, mib, bulbazord, jasonmolenda, JDevlieghere Differential Revision: https://reviews.llvm.org/D144937 Added: Modified: lldb/bindings/interface/SBWatchpointDocstrings.i lldb/docs/python_api_enums.rst lldb/include/lldb/API/SBType.h lldb/include/lldb/API/SBWatchpoint.h lldb/include/lldb/lldb-enumerations.h lldb/source/API/SBWatchpoint.cpp lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Removed: diff --git a/lldb/bindings/interface/SBWatchpointDocstrings.i b/lldb/bindings/interface/SBWatchpointDocstrings.i index 9bee8c751ef3b..4eb7b136282dc 100644 --- a/lldb/bindings/interface/SBWatchpointDocstrings.i +++ b/lldb/bindings/interface/SBWatchpointDocstrings.i @@ -19,3 +19,30 @@ watchpoints of the target." %feature("docstring", " The watchpoint stops only if the condition expression evaluates to true." ) lldb::SBWatchpoint::SetCondition; + +%feature("docstring", " +Returns the type recorded when the watchpoint was created. For variable +watchpoints it is the type of the watched variable. For expression +watchpoints it is the type of the provided expression." +) lldb::SBWatchpoint::GetType; + +%feature("docstring", " +Returns the kind of value that was watched when the watchpoint was created. +Returns one of the following eWatchPointValueKindVariable, +eWatchPointValueKindExpression, eWatchPointValueKindInvalid. +" +) lldb::SBWatchpoint::GetWatchValueKind; + +%feature("docstring", " +Get the spec for the watchpoint. For variable watchpoints this is the name +of the variable. For expression watchpoints it is empty +(may change in the future)." +) lldb::SBWatchpoint::GetWatchSpec; + +%feature("docstring", " +Returns true if the watchpoint is watching reads. Returns false otherwise." +) lldb::SBWatchpoint::IsWatchingReads; + +%feature("docstring", " +Returns true if the watchpoint is watching writes. Returns false otherwise." +) lldb::SBWatchpoint::IsWatchingWrites; diff --git a/lldb/docs/python_api_enums.rst b/lldb/docs/python_api_enums.rst index 6ae73df68c8ab..8fe2b7f301306 100644 --- a/lldb/docs/python_api_enums.rst +++ b/lldb/docs/python_api_enums.rst @@ -1407,3 +1407,24 @@ The result from a command interpreter run. .. py:data:: eCommandInterpreterResultQuitRequested Stopped because quit was requested. + + +.. _WatchPointValueKind: + +WatchPointValueKind +--- + +The type of value that the watchpoint was created to monitor. + +.. py:data:: eWatchPointValueKindInvalid + + Invalid kind. + +.. py:data:: eWatchPointValueKindVariable + + Watchpoint was created watching a variable + +.. py:data:: eWatchPointValueKindExpression + + Watchpoint was created watching the result of an expression that was + evaluated at creation time. diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h index 06433b0891beb..930f72eb36668 100644 --- a/lldb/include/lldb/API/SBType.h +++ b/lldb/include/lldb/API/SBType.h @@ -239,6 +239,7 @@ class SBType { friend class SBTypeMemberFunction; friend class SBTypeList; friend class SBValue; + friend class SBWatchpoint; SBType(const lldb_private::CompilerType &); SBType(const lldb::TypeSP &); diff --git a/lldb/include/lldb/API/SBWatchpoint.h b/lldb/