Commit ed7c8f7d by Nicolas Capens Committed by Nicolas Capens

Disable LLVM & Subzero stack traces and crash handling

LLVM has custom crash handling and stack trace printing code which may interfere with the application's error handling. Specifically, AddressSanitizer makes calls to SymInitialize() and SymSetOptions(). This change disables the config options, and adds a missing preprocessor conditional for ENABLE_BACKTRACES on Windows to match the Unix behavior. Bug: chromium:1033484 Change-Id: I3aa35d418212448c15eba4b0c3cc5b55c2da006e Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39888 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 0acac464
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "https://bugs.llvm.org/" #define BUG_REPORT_URL "https://bugs.llvm.org/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
/* #undef ENABLE_BACKTRACES */ #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
/* #undef ENABLE_CRASH_OVERRIDES */ #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */ /* #undef HAVE_BACKTRACE */
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "https://bugs.llvm.org/" #define BUG_REPORT_URL "https://bugs.llvm.org/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
/* #undef ENABLE_BACKTRACES */ #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
/* #undef ENABLE_CRASH_OVERRIDES */ #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */ /* #undef HAVE_BACKTRACE */
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
/* Define to 1 if you have the <ffi.h> header file. */ /* Define to 1 if you have the <ffi.h> header file. */
/* #undef HAVE_FFI_H */ /* #undef HAVE_FFI_H */
/* Define to 1 if you have the `futimens' function. */ /* Define to 1 if you have the `futimens' function. */
/* #undef HAVE_FUTIMENS */ /* #undef HAVE_FUTIMENS */
/* Define to 1 if you have the `futimes' function. */ /* Define to 1 if you have the `futimes' function. */
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "https://bugs.llvm.org/" #define BUG_REPORT_URL "https://bugs.llvm.org/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
/* #undef ENABLE_BACKTRACES */ #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
/* #undef ENABLE_CRASH_OVERRIDES */ #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */ /* #undef HAVE_BACKTRACE */
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "https://bugs.llvm.org/" #define BUG_REPORT_URL "https://bugs.llvm.org/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
/* #undef ENABLE_BACKTRACES */ #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
/* #undef ENABLE_CRASH_OVERRIDES */ #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */ /* #undef HAVE_BACKTRACE */
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "https://bugs.llvm.org/" #define BUG_REPORT_URL "https://bugs.llvm.org/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
/* #undef ENABLE_BACKTRACES */ #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
/* #undef ENABLE_CRASH_OVERRIDES */ #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */ /* #undef HAVE_BACKTRACE */
......
...@@ -297,6 +297,7 @@ static bool findModulesAndOffsets(void **StackTrace, int Depth, ...@@ -297,6 +297,7 @@ static bool findModulesAndOffsets(void **StackTrace, int Depth,
static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess, static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess,
HANDLE hThread, STACKFRAME64 &StackFrame, HANDLE hThread, STACKFRAME64 &StackFrame,
CONTEXT *Context) { CONTEXT *Context) {
#if ENABLE_BACKTRACES
// Initialize the symbol handler. // Initialize the symbol handler.
fSymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES); fSymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
fSymInitialize(hProcess, NULL, TRUE); fSymInitialize(hProcess, NULL, TRUE);
...@@ -378,6 +379,7 @@ static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess, ...@@ -378,6 +379,7 @@ static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess,
OS << '\n'; OS << '\n';
} }
#endif
} }
namespace llvm { namespace llvm {
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "http://llvm.org/bugs/" #define BUG_REPORT_URL "http://llvm.org/bugs/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
#define ENABLE_BACKTRACES 1 #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
#define ENABLE_CRASH_OVERRIDES 1 #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */ /* #undef HAVE_BACKTRACE */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#define ENABLE_BACKTRACES 0 #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
#define ENABLE_CRASH_OVERRIDES 1 #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
#define HAVE_BACKTRACE 1 #define HAVE_BACKTRACE 1
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "http://llvm.org/bugs/" #define BUG_REPORT_URL "http://llvm.org/bugs/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
#define ENABLE_BACKTRACES 1 #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
#define ENABLE_CRASH_OVERRIDES 1 #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
#define HAVE_BACKTRACE 1 #define HAVE_BACKTRACE 1
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "http://llvm.org/bugs/" #define BUG_REPORT_URL "http://llvm.org/bugs/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
#define ENABLE_BACKTRACES 1 #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
#define ENABLE_CRASH_OVERRIDES 1 #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
#define HAVE_BACKTRACE 1 #define HAVE_BACKTRACE 1
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
#define BUG_REPORT_URL "http://llvm.org/bugs/" #define BUG_REPORT_URL "http://llvm.org/bugs/"
/* Define to 1 to enable backtraces, and to 0 otherwise. */ /* Define to 1 to enable backtraces, and to 0 otherwise. */
#define ENABLE_BACKTRACES 1 #define ENABLE_BACKTRACES 0
/* Define to 1 to enable crash overrides, and to 0 otherwise. */ /* Define to 1 to enable crash overrides, and to 0 otherwise. */
#define ENABLE_CRASH_OVERRIDES 1 #define ENABLE_CRASH_OVERRIDES 0
/* Define to 1 if you have the `backtrace' function. */ /* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */ /* #undef HAVE_BACKTRACE */
......
...@@ -293,6 +293,7 @@ static bool findModulesAndOffsets(void **StackTrace, int Depth, ...@@ -293,6 +293,7 @@ static bool findModulesAndOffsets(void **StackTrace, int Depth,
static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess, static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess,
HANDLE hThread, STACKFRAME64 &StackFrame, HANDLE hThread, STACKFRAME64 &StackFrame,
CONTEXT *Context) { CONTEXT *Context) {
#if ENABLE_BACKTRACES
// Initialize the symbol handler. // Initialize the symbol handler.
fSymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES); fSymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
fSymInitialize(hProcess, NULL, TRUE); fSymInitialize(hProcess, NULL, TRUE);
...@@ -374,6 +375,7 @@ static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess, ...@@ -374,6 +375,7 @@ static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess,
OS << '\n'; OS << '\n';
} }
#endif
} }
namespace llvm { namespace llvm {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment