[PATCH] D133074: [cmake][wip] Add support for setting crash report directory
Paul Kirth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 31 17:15:00 PDT 2022
paulkirth created this revision.
paulkirth added a reviewer: phosek.
Herald added subscribers: Enna1, mgorny.
Herald added a project: All.
paulkirth requested review of this revision.
Herald added projects: Sanitizers, libc++, libc++abi, LLVM.
Herald added subscribers: llvm-commits, libcxx-commits, Sanitizers.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.
Crash reports and reproducers can be saved to a directory through
-fcrash-diagnostics-dir. This patch adds a CMAKE variable and plumbs
it through to the runtimes build targets in addition to Clang/LLVM
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133074
Files:
compiler-rt/lib/sanitizer_common/sanitizer_hash.h
llvm/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/runtimes/CMakeLists.txt
runtimes/CMakeLists.txt
Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -13,6 +13,9 @@
"${CMAKE_CURRENT_SOURCE_DIR}/../llvm/cmake/modules"
)
+ message("LLVM_ENABLE_CRASH_REPORT_DIR = ${LLVM_ENABLE_CRASH_REPORT_DIR}")
+ message("LLVM_CRASH_REPORT_DIR = ${LLVM_CRASH_REPORT_DIR}")
+
# We order libraries to mirror roughly how they are layered, except that compiler-rt can depend
# on libc++, so we put it after.
set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp")
Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -83,6 +83,7 @@
PASSTHROUGH_PREFIXES COMPILER_RT
DARWIN
SANITIZER
+ LLVM_CRASH_REPORT_DIR
USE_TOOLCHAIN
TARGET_TRIPLE ${LLVM_TARGET_TRIPLE}
${EXTRA_ARGS})
@@ -242,6 +243,7 @@
${RUNTIMES_CMAKE_ARGS}
PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
LLVM_USE_LINKER
+ LLVM_CRASH_REPORT_DIR
${ARG_PREFIXES}
EXTRA_TARGETS ${extra_targets}
${test_targets}
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -85,6 +85,10 @@
endif()
endif()
+if(DEFINED LLVM_CRASH_REPORT_DIR AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ append("-fcrash-diagnostics-dir=${LLVM_CRASH_REPORT_DIR}" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
+endif()
+
if(LLVM_ENABLE_EXPENSIVE_CHECKS)
add_definitions(-DEXPENSIVE_CHECKS)
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -862,6 +862,8 @@
" no longer supported.")
endif()
+set(LLVM_CRASH_REPORT_DIR "" CACHE STRING "Define directory name for crash reports" )
+
include(HandleLLVMOptions)
######
@@ -1201,6 +1203,8 @@
endif()
if( LLVM_INCLUDE_RUNTIMES )
+ message("LLVM_ENABLE_CRASH_REPORT_DIR = ${LLVM_ENABLE_CRASH_REPORT_DIR}")
+ message("LLVM_CRASH_REPORT_DIR = ${LLVM_CRASH_REPORT_DIR}")
add_subdirectory(runtimes)
endif()
Index: compiler-rt/lib/sanitizer_common/sanitizer_hash.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_hash.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_hash.h
@@ -12,6 +12,8 @@
#ifndef SANITIZER_HASH_H
#define SANITIZER_HASH_H
+#pragma clang __debug crash
+
#include "sanitizer_internal_defs.h"
namespace __sanitizer {
@@ -37,7 +39,7 @@
x ^= x >> 15;
return x;
}
-};
+}
class MurMur2Hash64Builder {
static const u64 m = 0xc6a4a7935bd1e995ull;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133074.457136.patch
Type: text/x-patch
Size: 3290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220901/e21aa6a6/attachment.bin>
More information about the llvm-commits
mailing list