brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 03dfde8 Raw
39 lines · cpp
1//===-- ubsan_diag_standalone.cpp -----------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// Diagnostic reporting for the standalone UBSan runtime.10//11//===----------------------------------------------------------------------===//12 13#include "ubsan_platform.h"14#if CAN_SANITIZE_UB15#include "ubsan_diag.h"16 17using namespace __ubsan;18 19void __sanitizer::BufferedStackTrace::UnwindImpl(20    uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) {21  uptr top = 0;22  uptr bottom = 0;23  GetThreadStackTopAndBottom(false, &top, &bottom);24  bool fast = StackTrace::WillUseFastUnwind(request_fast);25  Unwind(max_depth, pc, bp, context, top, bottom, fast);26}27 28extern "C" {29SANITIZER_INTERFACE_ATTRIBUTE30void __sanitizer_print_stack_trace() {31  GET_CURRENT_PC_BP;32  UNINITIALIZED BufferedStackTrace stack;33  stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal);34  stack.Print();35}36} // extern "C"37 38#endif  // CAN_SANITIZE_UB39