Update LOCAL_PATCHES after libsanitizer merge.
[official-gcc.git] / libsanitizer / ubsan / ubsan_diag_standalone.cc
blobddc1be7018c451fefc87d47986e53a5fbae8a739
1 //===-- ubsan_diag_standalone.cc ------------------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Diagnostic reporting for the standalone UBSan runtime.
9 //
10 //===----------------------------------------------------------------------===//
12 #include "ubsan_platform.h"
13 #if CAN_SANITIZE_UB
14 #include "ubsan_diag.h"
16 using namespace __ubsan;
18 extern "C" {
19 SANITIZER_INTERFACE_ATTRIBUTE
20 void __sanitizer_print_stack_trace() {
21 uptr top = 0;
22 uptr bottom = 0;
23 bool request_fast_unwind = common_flags()->fast_unwind_on_fatal;
24 if (request_fast_unwind)
25 __sanitizer::GetThreadStackTopAndBottom(false, &top, &bottom);
27 GET_CURRENT_PC_BP_SP;
28 (void)sp;
29 BufferedStackTrace stack;
30 stack.Unwind(kStackTraceMax, pc, bp, nullptr, top, bottom,
31 request_fast_unwind);
32 stack.Print();
34 } // extern "C"
36 #endif // CAN_SANITIZE_UB