summaryrefslogtreecommitdiff
path: root/lib/ubsan/ubsan_flags.h
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-07-23 18:44:54 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-07-23 18:44:54 +0000
commit805b0e8f7f27a88fe1930bf346c48499655fe091 (patch)
tree2bc0bf34098d52a235b897a46b2ffedf71df2aef /lib/ubsan/ubsan_flags.h
parentbb7c4cb9e8f061711b833931b3f4197af5d9a090 (diff)
[UBSan] Add the ability to dump call stacks to -fsanitize=vptr
This change introduces the first UBSan-specific runtime flag: print_stacktrace (off by default). It can be set in UBSAN_OPTIONS to unwind and print call stacks in addition to diagnostic messages. For now these stacks are printed only in vptr checker. This change is based on http://reviews.llvm.org/D4410 by Byoungyoung Lee! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@213783 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan/ubsan_flags.h')
-rw-r--r--lib/ubsan/ubsan_flags.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/ubsan/ubsan_flags.h b/lib/ubsan/ubsan_flags.h
new file mode 100644
index 000000000..db0a4e4aa
--- /dev/null
+++ b/lib/ubsan/ubsan_flags.h
@@ -0,0 +1,29 @@
+//===-- ubsan_flags.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Runtime flags for UndefinedBehaviorSanitizer.
+//
+//===----------------------------------------------------------------------===//
+#ifndef UBSAN_FLAGS_H
+#define UBSAN_FLAGS_H
+
+namespace __ubsan {
+
+struct Flags {
+ bool print_stacktrace;
+};
+
+extern Flags ubsan_flags;
+inline Flags *flags() { return &ubsan_flags; }
+
+void InitializeFlags();
+
+} // namespace __ubsan
+
+#endif // UBSAN_FLAGS_H