]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/ubsan/ubsan_diag_standalone.cc
Merge ^/head r320042 through r320397.
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / ubsan / ubsan_diag_standalone.cc
1 //===-- ubsan_diag_standalone.cc ------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Diagnostic reporting for the standalone UBSan runtime.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "ubsan_platform.h"
15 #if CAN_SANITIZE_UB
16 #include "ubsan_diag.h"
17
18 using namespace __ubsan;
19
20 extern "C" {
21 SANITIZER_INTERFACE_ATTRIBUTE
22 void __sanitizer_print_stack_trace() {
23   uptr top = 0;
24   uptr bottom = 0;
25   bool request_fast_unwind = common_flags()->fast_unwind_on_fatal;
26   if (request_fast_unwind)
27     __sanitizer::GetThreadStackTopAndBottom(false, &top, &bottom);
28
29   GET_REPORT_OPTIONS(false);
30   BufferedStackTrace stack;
31   stack.Unwind(kStackTraceMax, Opts.pc, Opts.bp, nullptr, top, bottom,
32                request_fast_unwind);
33   stack.Print();
34 }
35 } // extern "C"
36
37 #endif  // CAN_SANITIZE_UB