Path: blob/main/contrib/llvm-project/compiler-rt/lib/ubsan/ubsan_diag_standalone.cpp
35233 views
//===-- ubsan_diag_standalone.cpp -----------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Diagnostic reporting for the standalone UBSan runtime.9//10//===----------------------------------------------------------------------===//1112#include "ubsan_platform.h"13#if CAN_SANITIZE_UB14#include "ubsan_diag.h"1516using namespace __ubsan;1718void __sanitizer::BufferedStackTrace::UnwindImpl(19uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) {20uptr top = 0;21uptr bottom = 0;22GetThreadStackTopAndBottom(false, &top, &bottom);23bool fast = StackTrace::WillUseFastUnwind(request_fast);24Unwind(max_depth, pc, bp, context, top, bottom, fast);25}2627extern "C" {28SANITIZER_INTERFACE_ATTRIBUTE29void __sanitizer_print_stack_trace() {30GET_CURRENT_PC_BP;31BufferedStackTrace stack;32stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal);33stack.Print();34}35} // extern "C"3637#endif // CAN_SANITIZE_UB383940