<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">This caused three failures on macOS.<div class=""><div class="">I reverted the patch to unbreak the bots.</div><div class=""><a href="http://lab.llvm.org:8080/green/job/lldb-cmake/8565/console" class="">http://lab.llvm.org:8080/green/job/lldb-cmake/8565/console</a></div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">—</div><div class="">Davide</div><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 10, 2020, at 01:33, Jan Kratochvil via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">Author: Jan Kratochvil<br class="">Date: 2020-02-10T10:29:32+01:00<br class="">New Revision: 1a39f1b966a8d8f15ed0d5a832d5097cccefe93b<br class=""><br class="">URL: <a href="https://github.com/llvm/llvm-project/commit/1a39f1b966a8d8f15ed0d5a832d5097cccefe93b" class="">https://github.com/llvm/llvm-project/commit/1a39f1b966a8d8f15ed0d5a832d5097cccefe93b</a><br class="">DIFF: <a href="https://github.com/llvm/llvm-project/commit/1a39f1b966a8d8f15ed0d5a832d5097cccefe93b.diff" class="">https://github.com/llvm/llvm-project/commit/1a39f1b966a8d8f15ed0d5a832d5097cccefe93b.diff</a><br class=""><br class="">LOG: [lldb] Fix+re-enable Assert StackFrame Recognizer on Linux<br class=""><br class="">D73303 was failing on Fedora Linux and so it was disabled by Skip the<br class="">AssertFrameRecognizer test for Linux.<br class=""><br class="">I find no easy way how to find out if it gets recognized as<br class="">`__assert_fail` or `__GI___assert_fail` as during `Process` ctor<br class="">libc.so.6 is not yet loaded by the debuggee.<br class=""><br class="">DWARF symbol `__GI___assert_fail` overrides the ELF symbol `__assert_fail`.<br class="">While external debug info (=DWARF) gets disabled for testsuite (D55859)<br class="">that sure does not apply for real world usage.<br class=""><br class="">Differential Revision: <a href="https://reviews.llvm.org/D74252" class="">https://reviews.llvm.org/D74252</a><br class=""><br class="">Added: <br class=""><br class=""><br class="">Modified: <br class=""> lldb/include/lldb/Target/StackFrameRecognizer.h<br class=""> lldb/source/Commands/CommandObjectFrame.cpp<br class=""> lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp<br class=""> lldb/source/Target/AssertFrameRecognizer.cpp<br class=""> lldb/source/Target/StackFrameRecognizer.cpp<br class=""> lldb/test/Shell/Recognizer/assert.test<br class=""> lldb/unittests/Target/StackFrameRecognizerTest.cpp<br class=""><br class="">Removed: <br class=""><br class=""><br class=""><br class="">################################################################################<br class="">diff --git a/lldb/include/lldb/Target/StackFrameRecognizer.h b/lldb/include/lldb/Target/StackFrameRecognizer.h<br class="">index b509e0760b31..92cfca4227cf 100644<br class="">--- a/lldb/include/lldb/Target/StackFrameRecognizer.h<br class="">+++ b/lldb/include/lldb/Target/StackFrameRecognizer.h<br class="">@@ -101,8 +101,8 @@ class ScriptedStackFrameRecognizer : public StackFrameRecognizer {<br class=""> class StackFrameRecognizerManager {<br class=""> public:<br class=""> static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,<br class="">- ConstString module,<br class="">- ConstString symbol,<br class="">+ ConstString module, ConstString symbol,<br class="">+ ConstString alternate_symbol,<br class=""> bool first_instruction_only = true);<br class=""><br class=""> static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,<br class="">@@ -113,7 +113,8 @@ class StackFrameRecognizerManager {<br class=""> static void ForEach(<br class=""> std::function<void(uint32_t recognizer_id, std::string recognizer_name,<br class=""> std::string module, std::string symbol,<br class="">- bool regexp)> const &callback);<br class="">+ std::string alternate_symbol, bool regexp)> const<br class="">+ &callback);<br class=""><br class=""> static bool RemoveRecognizerWithID(uint32_t recognizer_id);<br class=""><br class=""><br class="">diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp<br class="">index d86b50bd7aad..5af9e2e314be 100644<br class="">--- a/lldb/source/Commands/CommandObjectFrame.cpp<br class="">+++ b/lldb/source/Commands/CommandObjectFrame.cpp<br class="">@@ -881,7 +881,7 @@ bool CommandObjectFrameRecognizerAdd::DoExecute(Args &command,<br class=""> } else {<br class=""> auto module = ConstString(m_options.m_module);<br class=""> auto func = ConstString(m_options.m_function);<br class="">- StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, func);<br class="">+ StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, func, {});<br class=""> }<br class=""> #endif<br class=""><br class="">@@ -960,12 +960,13 @@ class CommandObjectFrameRecognizerList : public CommandObjectParsed {<br class=""> StackFrameRecognizerManager::ForEach(<br class=""> [&result, &any_printed](uint32_t recognizer_id, std::string name,<br class=""> std::string function, std::string symbol,<br class="">- bool regexp) {<br class="">+ std::string alternate_symbol, bool regexp) {<br class=""> if (name == "")<br class=""> name = "(internal)";<br class=""> result.GetOutputStream().Printf(<br class="">- "%d: %s, module %s, function %s%s\n", recognizer_id, name.c_str(),<br class="">- function.c_str(), symbol.c_str(), regexp ? " (regexp)" : "");<br class="">+ "%d: %s, module %s, function %s{%s}%s\n", recognizer_id,<br class="">+ name.c_str(), function.c_str(), symbol.c_str(),<br class="">+ alternate_symbol.c_str(), regexp ? " (regexp)" : "");<br class=""> any_printed = true;<br class=""> });<br class=""><br class=""><br class="">diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp<br class="">index 6acc23176248..62d16296bd66 100644<br class="">--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp<br class="">+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp<br class="">@@ -2691,6 +2691,7 @@ static void RegisterObjCExceptionRecognizer() {<br class=""> std::tie(module, function) = AppleObjCRuntime::GetExceptionThrowLocation();<br class=""> StackFrameRecognizerManager::AddRecognizer(<br class=""> StackFrameRecognizerSP(new ObjCExceptionThrowFrameRecognizer()),<br class="">- module.GetFilename(), function, /*first_instruction_only*/ true);<br class="">+ module.GetFilename(), function, /*alternate_symbol*/ {},<br class="">+ /*first_instruction_only*/ true);<br class=""> });<br class=""> }<br class=""><br class="">diff --git a/lldb/source/Target/AssertFrameRecognizer.cpp b/lldb/source/Target/AssertFrameRecognizer.cpp<br class="">index 89ed3ce022d9..b024ee7ba97c 100644<br class="">--- a/lldb/source/Target/AssertFrameRecognizer.cpp<br class="">+++ b/lldb/source/Target/AssertFrameRecognizer.cpp<br class="">@@ -16,26 +16,6 @@ using namespace lldb;<br class=""> using namespace lldb_private;<br class=""><br class=""> namespace lldb_private {<br class="">-/// Checkes if the module containing a symbol has debug info.<br class="">-///<br class="">-/// \param[in] target<br class="">-/// The target containing the module.<br class="">-/// \param[in] module_spec<br class="">-/// The module spec that should contain the symbol.<br class="">-/// \param[in] symbol_name<br class="">-/// The symbol's name that should be contained in the debug info.<br class="">-/// \return<br class="">-/// If \b true the symbol was found, \b false otherwise.<br class="">-bool ModuleHasDebugInfo(Target &target, FileSpec &module_spec,<br class="">- StringRef symbol_name) {<br class="">- ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec);<br class="">-<br class="">- if (!module_sp)<br class="">- return false;<br class="">-<br class="">- return module_sp->FindFirstSymbolWithNameAndType(ConstString(symbol_name));<br class="">-}<br class="">-<br class=""> /// Fetches the abort frame location depending on the current platform.<br class=""> ///<br class=""> /// \param[in] process_sp<br class="">@@ -43,14 +23,15 @@ bool ModuleHasDebugInfo(Target &target, FileSpec &module_spec,<br class=""> /// the target and the platform.<br class=""> /// \return<br class=""> /// If the platform is supported, returns an optional tuple containing<br class="">-/// the abort module as a \a FileSpec and the symbol name as a \a StringRef.<br class="">+/// the abort module as a \a FileSpec and two symbol names as two \a<br class="">+/// StringRef. The second \a StringRef may be empty.<br class=""> /// Otherwise, returns \a llvm::None.<br class="">-llvm::Optional<std::tuple<FileSpec, StringRef>><br class="">+llvm::Optional<std::tuple<FileSpec, StringRef, StringRef>><br class=""> GetAbortLocation(Process *process) {<br class=""> Target &target = process->GetTarget();<br class=""><br class=""> FileSpec module_spec;<br class="">- StringRef symbol_name;<br class="">+ StringRef symbol_name, alternate_symbol_name;<br class=""><br class=""> switch (target.GetArchitecture().GetTriple().getOS()) {<br class=""> case llvm::Triple::Darwin:<br class="">@@ -60,9 +41,8 @@ GetAbortLocation(Process *process) {<br class=""> break;<br class=""> case llvm::Triple::Linux:<br class=""> module_spec = FileSpec("libc.so.6");<br class="">- symbol_name = "__GI_raise";<br class="">- if (!ModuleHasDebugInfo(target, module_spec, symbol_name))<br class="">- symbol_name = "raise";<br class="">+ symbol_name = "raise";<br class="">+ alternate_symbol_name = "__GI_raise";<br class=""> break;<br class=""> default:<br class=""> Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));<br class="">@@ -70,7 +50,7 @@ GetAbortLocation(Process *process) {<br class=""> return llvm::None;<br class=""> }<br class=""><br class="">- return std::make_tuple(module_spec, symbol_name);<br class="">+ return std::make_tuple(module_spec, symbol_name, alternate_symbol_name);<br class=""> }<br class=""><br class=""> /// Fetches the assert frame location depending on the current platform.<br class="">@@ -80,15 +60,15 @@ GetAbortLocation(Process *process) {<br class=""> /// the target and the platform.<br class=""> /// \return<br class=""> /// If the platform is supported, returns an optional tuple containing<br class="">-/// the asserting frame module as a \a FileSpec and the symbol name as a \a<br class="">-/// StringRef.<br class="">+/// the asserting frame module as a \a FileSpec and two possible symbol<br class="">+/// names as two \a StringRef. The second \a StringRef may be empty.<br class=""> /// Otherwise, returns \a llvm::None.<br class="">-llvm::Optional<std::tuple<FileSpec, StringRef>><br class="">+llvm::Optional<std::tuple<FileSpec, StringRef, StringRef>><br class=""> GetAssertLocation(Process *process) {<br class=""> Target &target = process->GetTarget();<br class=""><br class=""> FileSpec module_spec;<br class="">- StringRef symbol_name;<br class="">+ StringRef symbol_name, alternate_symbol_name;<br class=""><br class=""> switch (target.GetArchitecture().GetTriple().getOS()) {<br class=""> case llvm::Triple::Darwin:<br class="">@@ -98,9 +78,8 @@ GetAssertLocation(Process *process) {<br class=""> break;<br class=""> case llvm::Triple::Linux:<br class=""> module_spec = FileSpec("libc.so.6");<br class="">- symbol_name = "__GI___assert_fail";<br class="">- if (!ModuleHasDebugInfo(target, module_spec, symbol_name))<br class="">- symbol_name = "__assert_fail";<br class="">+ symbol_name = "__assert_fail";<br class="">+ alternate_symbol_name = "__GI___assert_fail";<br class=""> break;<br class=""> default:<br class=""> Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));<br class="">@@ -108,7 +87,7 @@ GetAssertLocation(Process *process) {<br class=""> return llvm::None;<br class=""> }<br class=""><br class="">- return std::make_tuple(module_spec, symbol_name);<br class="">+ return std::make_tuple(module_spec, symbol_name, alternate_symbol_name);<br class=""> }<br class=""><br class=""> void RegisterAssertFrameRecognizer(Process *process) {<br class="">@@ -120,12 +99,14 @@ void RegisterAssertFrameRecognizer(Process *process) {<br class=""> return;<br class=""><br class=""> FileSpec module_spec;<br class="">- StringRef function_name;<br class="">- std::tie(module_spec, function_name) = *abort_location;<br class="">+ StringRef function_name, alternate_function_name;<br class="">+ std::tie(module_spec, function_name, alternate_function_name) =<br class="">+ *abort_location;<br class=""><br class=""> StackFrameRecognizerManager::AddRecognizer(<br class=""> StackFrameRecognizerSP(new AssertFrameRecognizer()),<br class="">- module_spec.GetFilename(), ConstString(function_name), false);<br class="">+ module_spec.GetFilename(), ConstString(function_name),<br class="">+ ConstString(alternate_function_name), /*first_instruction_only*/ false);<br class=""> });<br class=""> }<br class=""><br class="">@@ -142,8 +123,9 @@ AssertFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame_sp) {<br class=""> return RecognizedStackFrameSP();<br class=""><br class=""> FileSpec module_spec;<br class="">- StringRef function_name;<br class="">- std::tie(module_spec, function_name) = *assert_location;<br class="">+ StringRef function_name, alternate_function_name;<br class="">+ std::tie(module_spec, function_name, alternate_function_name) =<br class="">+ *assert_location;<br class=""><br class=""> const uint32_t frames_to_fetch = 5;<br class=""> const uint32_t last_frame_index = frames_to_fetch - 1;<br class="">@@ -163,8 +145,13 @@ AssertFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame_sp) {<br class=""> SymbolContext sym_ctx =<br class=""> prev_frame_sp->GetSymbolContext(eSymbolContextEverything);<br class=""><br class="">- if (sym_ctx.module_sp->GetFileSpec().FileEquals(module_spec) &&<br class="">- sym_ctx.GetFunctionName() == ConstString(function_name)) {<br class="">+ if (!sym_ctx.module_sp->GetFileSpec().FileEquals(module_spec))<br class="">+ continue;<br class="">+<br class="">+ ConstString func_name = sym_ctx.GetFunctionName();<br class="">+ if (func_name == ConstString(function_name) ||<br class="">+ alternate_function_name.empty() ||<br class="">+ func_name == ConstString(alternate_function_name)) {<br class=""><br class=""> // We go a frame beyond the assert location because the most relevant<br class=""> // frame for the user is the one in which the assert function was called.<br class=""><br class="">diff --git a/lldb/source/Target/StackFrameRecognizer.cpp b/lldb/source/Target/StackFrameRecognizer.cpp<br class="">index 14cba23b4bfa..479e13fadc08 100644<br class="">--- a/lldb/source/Target/StackFrameRecognizer.cpp<br class="">+++ b/lldb/source/Target/StackFrameRecognizer.cpp<br class="">@@ -50,24 +50,28 @@ ScriptedStackFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame) {<br class=""><br class=""> class StackFrameRecognizerManagerImpl {<br class=""> public:<br class="">- void AddRecognizer(StackFrameRecognizerSP recognizer,<br class="">- ConstString module, ConstString symbol,<br class="">+ void AddRecognizer(StackFrameRecognizerSP recognizer, ConstString module,<br class="">+ ConstString symbol, ConstString alternate_symbol,<br class=""> bool first_instruction_only) {<br class="">- m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer, false, module, RegularExpressionSP(),<br class="">- symbol, RegularExpressionSP(),<br class="">+ m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer,<br class="">+ false, module, RegularExpressionSP(), symbol,<br class="">+ alternate_symbol, RegularExpressionSP(),<br class=""> first_instruction_only});<br class=""> }<br class=""><br class=""> void AddRecognizer(StackFrameRecognizerSP recognizer,<br class=""> RegularExpressionSP module, RegularExpressionSP symbol,<br class=""> bool first_instruction_only) {<br class="">- m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer, true, ConstString(), module,<br class="">+ m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer,<br class="">+ true, ConstString(), module, ConstString(),<br class=""> ConstString(), symbol, first_instruction_only});<br class=""> }<br class=""><br class=""> void ForEach(<br class="">- std::function<void(uint32_t recognized_id, std::string recognizer_name, std::string module,<br class="">- std::string symbol, bool regexp)> const &callback) {<br class="">+ std::function<void(uint32_t recognized_id, std::string recognizer_name,<br class="">+ std::string module, std::string symbol,<br class="">+ std::string alternate_symbol, bool regexp)> const<br class="">+ &callback) {<br class=""> for (auto entry : m_recognizers) {<br class=""> if (entry.is_regexp) {<br class=""> std::string module_name;<br class="">@@ -79,11 +83,12 @@ class StackFrameRecognizerManagerImpl {<br class=""> symbol_name = entry.symbol_regexp->GetText().str();<br class=""><br class=""> callback(entry.recognizer_id, entry.recognizer->GetName(), module_name,<br class="">- symbol_name, true);<br class="">+ symbol_name, {}, true);<br class=""><br class=""> } else {<br class="">- callback(entry.recognizer_id, entry.recognizer->GetName(), entry.module.GetCString(),<br class="">- entry.symbol.GetCString(), false);<br class="">+ callback(entry.recognizer_id, entry.recognizer->GetName(),<br class="">+ entry.module.GetCString(), entry.symbol.GetCString(),<br class="">+ entry.alternate_symbol.GetCString(), false);<br class=""> }<br class=""> }<br class=""> }<br class="">@@ -120,7 +125,10 @@ class StackFrameRecognizerManagerImpl {<br class=""> if (!entry.module_regexp->Execute(module_name.GetStringRef())) continue;<br class=""><br class=""> if (entry.symbol)<br class="">- if (entry.symbol != function_name) continue;<br class="">+ if (entry.symbol != function_name &&<br class="">+ (!entry.alternate_symbol ||<br class="">+ entry.alternate_symbol != function_name))<br class="">+ continue;<br class=""><br class=""> if (entry.symbol_regexp)<br class=""> if (!entry.symbol_regexp->Execute(function_name.GetStringRef()))<br class="">@@ -149,6 +157,7 @@ class StackFrameRecognizerManagerImpl {<br class=""> ConstString module;<br class=""> RegularExpressionSP module_regexp;<br class=""> ConstString symbol;<br class="">+ ConstString alternate_symbol;<br class=""> RegularExpressionSP symbol_regexp;<br class=""> bool first_instruction_only;<br class=""> };<br class="">@@ -163,10 +172,10 @@ StackFrameRecognizerManagerImpl &GetStackFrameRecognizerManagerImpl() {<br class=""> }<br class=""><br class=""> void StackFrameRecognizerManager::AddRecognizer(<br class="">- StackFrameRecognizerSP recognizer, ConstString module,<br class="">- ConstString symbol, bool first_instruction_only) {<br class="">- GetStackFrameRecognizerManagerImpl().AddRecognizer(recognizer, module, symbol,<br class="">- first_instruction_only);<br class="">+ StackFrameRecognizerSP recognizer, ConstString module, ConstString symbol,<br class="">+ ConstString alternate_symbol, bool first_instruction_only) {<br class="">+ GetStackFrameRecognizerManagerImpl().AddRecognizer(<br class="">+ recognizer, module, symbol, alternate_symbol, first_instruction_only);<br class=""> }<br class=""><br class=""> void StackFrameRecognizerManager::AddRecognizer(<br class="">@@ -177,8 +186,10 @@ void StackFrameRecognizerManager::AddRecognizer(<br class=""> }<br class=""><br class=""> void StackFrameRecognizerManager::ForEach(<br class="">- std::function<void(uint32_t recognized_id, std::string recognizer_name, std::string module,<br class="">- std::string symbol, bool regexp)> const &callback) {<br class="">+ std::function<void(uint32_t recognized_id, std::string recognizer_name,<br class="">+ std::string module, std::string symbol,<br class="">+ std::string alternate_symbol, bool regexp)> const<br class="">+ &callback) {<br class=""> GetStackFrameRecognizerManagerImpl().ForEach(callback);<br class=""> }<br class=""><br class=""><br class="">diff --git a/lldb/test/Shell/Recognizer/assert.test b/lldb/test/Shell/Recognizer/assert.test<br class="">index 6bcc009f333e..9b4aa21611e0 100644<br class="">--- a/lldb/test/Shell/Recognizer/assert.test<br class="">+++ b/lldb/test/Shell/Recognizer/assert.test<br class="">@@ -1,4 +1,4 @@<br class="">-# UNSUPPORTED: system-windows, system-linux<br class="">+# UNSUPPORTED: system-windows<br class=""> # RUN: %clang_host -g -O0 %S/Inputs/assert.c -o %t.out<br class=""> # RUN: %lldb -b -s %s %t.out | FileCheck %s<br class=""> run<br class=""><br class="">diff --git a/lldb/unittests/Target/StackFrameRecognizerTest.cpp b/lldb/unittests/Target/StackFrameRecognizerTest.cpp<br class="">index 5220796acb4b..f7b7829e2bb8 100644<br class="">--- a/lldb/unittests/Target/StackFrameRecognizerTest.cpp<br class="">+++ b/lldb/unittests/Target/StackFrameRecognizerTest.cpp<br class="">@@ -77,6 +77,7 @@ TEST_F(StackFrameRecognizerTest, NullModuleRegex) {<br class=""> StackFrameRecognizerManager::ForEach(<br class=""> [&any_printed](uint32_t recognizer_id, std::string name,<br class=""> std::string function, std::string symbol,<br class="">+ std::string alternate_symbol,<br class=""> bool regexp) { any_printed = true; });<br class=""><br class=""> EXPECT_TRUE(any_printed);<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">lldb-commits mailing list<br class=""><a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits<br class=""></div></div></blockquote></div><br class=""></div></body></html>