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//===----------------------------------------------------------------------===// 11 12#include "ubsan_platform.h" 13#if CAN_SANITIZE_UB 14#include "ubsan_diag.h" 15 16using namespace __ubsan; 17 18extern "C" { 19SANITIZER_INTERFACE_ATTRIBUTE 20void __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); 26 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(); 33} 34} // extern "C" 35 36#endif // CAN_SANITIZE_UB 37