From f1b41d1ccaedb20cc31b1c38df05f03a6f77f10b Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 30 Oct 2015 14:28:24 -0400
Subject: [PATCH] P4 to Git Change 1206023 by yaxunl@yaxunl_stg_win50 on
2015/10/30 14:17:53
SWDEV-80261 - Enable dump stack trace in debug build when assert/abort/segfault to facilitate debugging.
It is useful to see the stack trace when program assert(), especially in teamcity when some issues are not reproducible locally. This change enables that.
Only enabled for debug build.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/v0_8/if_acl.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#83 edit
---
.../lib/backends/common/v0_8/if_acl.cpp | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
index 801166fb02..c78fe207f4 100644
--- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
+++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
@@ -96,6 +96,10 @@ if_aclCompilerInit(aclCompiler *cl, aclBinary *bin,
#endif
));
}
+#ifndef NDEBUG
+ llvm::EnablePrettyStackTrace();
+ llvm::sys::PrintStackTraceOnErrorSignal();
+#endif
// Initialize targets first.
llvm::InitializeAllTargets();
@@ -1437,24 +1441,10 @@ if_aclCompile(aclCompiler *cl,
}
#ifdef WITH_TARGET_HSAIL
if (isHSAILTarget(bin->target)) {
-#ifndef DEBUG
- // Do not install signal handlers for the pretty stack trace.
-#if defined(LEGACY_COMPLIB)
- llvm::DisablePrettyStackTrace = true;
-#endif
-#else
-#if !defined(LEGACY_COMPLIB)
- llvm::EnablePrettyStackTrace();
-#endif
- llvm::sys::PrintStackTraceOnErrorSignal();
-#endif
} else
#endif
{
llvm::InitializeAllAsmParsers();
-#if defined(LEGACY_COMPLIB)
- llvm::DisablePrettyStackTrace = true;
-#endif
llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry();
llvm::initializeSPIRVerifierPass(Registry);
}