summaryrefslogtreecommitdiff
path: root/lib/ubsan/ubsan_diag.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_diag.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_diag.h')
-rw-r--r--lib/ubsan/ubsan_diag.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ubsan/ubsan_diag.h b/lib/ubsan/ubsan_diag.h
index 54d15a0cc..033695190 100644
--- a/lib/ubsan/ubsan_diag.h
+++ b/lib/ubsan/ubsan_diag.h
@@ -14,6 +14,7 @@
#define UBSAN_DIAG_H
#include "ubsan_value.h"
+#include "sanitizer_common/sanitizer_stacktrace.h"
namespace __ubsan {
@@ -203,6 +204,13 @@ public:
Diag &operator<<(const Range &R) { return AddRange(R); }
};
+void MaybePrintStackTrace(uptr pc, uptr bp);
+
+#define MAYBE_PRINT_STACK_TRACE() do { \
+ GET_CALLER_PC_BP_SP; \
+ MaybePrintStackTrace(pc, bp); \
+} while (0)
+
} // namespace __ubsan
#endif // UBSAN_DIAG_H