aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2020-02-08 05:08:48 +0100
committerJan Kratochvil <jan.kratochvil@redhat.com>2020-02-08 05:08:48 +0100
commit6ef4786dbcd47cfe346ee8679ba0b4d320da797d (patch)
tree2677324463563bc92d1a08756c9fa4583dcf66e4
parent7b627bb6e019b5457aa64ea19debefe307f68a19 (diff)
downloadllvm-6ef4786dbcd47cfe346ee8679ba0b4d320da797d.zip
llvm-6ef4786dbcd47cfe346ee8679ba0b4d320da797d.tar.gz
llvm-6ef4786dbcd47cfe346ee8679ba0b4d320da797d.tar.bz2
Revert "[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux"
This reverts commit cf1046c716b33ed449aa8fc26376864917c63c25. Reverted: https://reviews.llvm.org/D74252 It fixed testsuite but broke real world functionality where is not used: settings set symbols.enable-external-lookup false
-rw-r--r--lldb/source/Target/AssertFrameRecognizer.cpp28
-rw-r--r--lldb/test/Shell/Recognizer/assert.test2
2 files changed, 27 insertions, 3 deletions
diff --git a/lldb/source/Target/AssertFrameRecognizer.cpp b/lldb/source/Target/AssertFrameRecognizer.cpp
index e778ab6..89ed3ce 100644
--- a/lldb/source/Target/AssertFrameRecognizer.cpp
+++ b/lldb/source/Target/AssertFrameRecognizer.cpp
@@ -16,6 +16,26 @@ using namespace lldb;
using namespace lldb_private;
namespace lldb_private {
+/// Checkes if the module containing a symbol has debug info.
+///
+/// \param[in] target
+/// The target containing the module.
+/// \param[in] module_spec
+/// The module spec that should contain the symbol.
+/// \param[in] symbol_name
+/// The symbol's name that should be contained in the debug info.
+/// \return
+/// If \b true the symbol was found, \b false otherwise.
+bool ModuleHasDebugInfo(Target &target, FileSpec &module_spec,
+ StringRef symbol_name) {
+ ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec);
+
+ if (!module_sp)
+ return false;
+
+ return module_sp->FindFirstSymbolWithNameAndType(ConstString(symbol_name));
+}
+
/// Fetches the abort frame location depending on the current platform.
///
/// \param[in] process_sp
@@ -40,7 +60,9 @@ GetAbortLocation(Process *process) {
break;
case llvm::Triple::Linux:
module_spec = FileSpec("libc.so.6");
- symbol_name = "raise";
+ symbol_name = "__GI_raise";
+ if (!ModuleHasDebugInfo(target, module_spec, symbol_name))
+ symbol_name = "raise";
break;
default:
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
@@ -76,7 +98,9 @@ GetAssertLocation(Process *process) {
break;
case llvm::Triple::Linux:
module_spec = FileSpec("libc.so.6");
- symbol_name = "__assert_fail";
+ symbol_name = "__GI___assert_fail";
+ if (!ModuleHasDebugInfo(target, module_spec, symbol_name))
+ symbol_name = "__assert_fail";
break;
default:
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
diff --git a/lldb/test/Shell/Recognizer/assert.test b/lldb/test/Shell/Recognizer/assert.test
index 9b4aa21..6bcc009 100644
--- a/lldb/test/Shell/Recognizer/assert.test
+++ b/lldb/test/Shell/Recognizer/assert.test
@@ -1,4 +1,4 @@
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, system-linux
# RUN: %clang_host -g -O0 %S/Inputs/assert.c -o %t.out
# RUN: %lldb -b -s %s %t.out | FileCheck %s
run