diff options
author | Dmitriy Nikiforov <d.nikiforov@samsung.com> | 2017-10-25 20:31:52 +0300 |
---|---|---|
committer | Dongkyun Son <dongkyun.s@samsung.com> | 2017-11-21 08:52:57 +0000 |
commit | 1bff4e116ba869f7087a6851ce6eeb7f5bcffd36 (patch) | |
tree | b36facbb79aef14c8203e0d591af7236cb26cb31 | |
parent | 1e2e7190ec99d5aa065f3bc3f7c69ac1b845ac16 (diff) | |
download | linaro-gcc-1bff4e116ba869f7087a6851ce6eeb7f5bcffd36.tar.gz linaro-gcc-1bff4e116ba869f7087a6851ce6eeb7f5bcffd36.tar.bz2 linaro-gcc-1bff4e116ba869f7087a6851ce6eeb7f5bcffd36.zip |
[UBSan] Add __sanitizer_print_stack_trace() for UBSansubmit/tizen_base/20171123.084139
libsanitizer/
* ubsan/ubsan_diag.cc (__sanitizer_print_stack_trace): New function.
* ubsan/ubsan_diag.cc (PrintStackTrace): New function.
Change-Id: I270b3765a571381fcf400b8e54f66dfa291e4862
-rw-r--r-- | libsanitizer/ubsan/ubsan_diag.cc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libsanitizer/ubsan/ubsan_diag.cc b/libsanitizer/ubsan/ubsan_diag.cc index dac0937e819..9adfb6b21fc 100644 --- a/libsanitizer/ubsan/ubsan_diag.cc +++ b/libsanitizer/ubsan/ubsan_diag.cc @@ -25,11 +25,7 @@ using namespace __ubsan; -static void MaybePrintStackTrace(uptr pc, uptr bp) { - // We assume that flags are already parsed, as UBSan runtime - // will definitely be called when we print the first diagnostics message. - if (!flags()->print_stacktrace) - return; +static void PrintStackTrace(uptr pc, uptr bp) { // We can only use slow unwind, as we don't have any information about stack // top/bottom. // FIXME: It's better to respect "fast_unwind_on_fatal" runtime flag and @@ -42,6 +38,15 @@ static void MaybePrintStackTrace(uptr pc, uptr bp) { stack.Print(); } +static void MaybePrintStackTrace(uptr pc, uptr bp) { + // We assume that flags are already parsed, as UBSan runtime + // will definitely be called when we print the first diagnostics message. + if (!flags()->print_stacktrace) + return; + + PrintStackTrace(pc, bp); +} + static const char *ConvertTypeToString(ErrorType Type) { switch (Type) { #define UBSAN_CHECK(Name, SummaryKind, FSanitizeFlagName) \ @@ -476,4 +481,13 @@ bool __ubsan::IsISanFunctionCheckSuppressed(ReportOptions *Opts) { return false; } +extern "C" SANITIZER_INTERFACE_ATTRIBUTE +void __sanitizer_print_stack_trace() { + using namespace __ubsan; + + GET_REPORT_OPTIONS(false); + + PrintStackTrace(Opts.pc, Opts.bp); +} + #endif // CAN_SANITIZE_UB |