Path: blob/main/contrib/llvm-project/compiler-rt/lib/ubsan/ubsan_monitor.h
35233 views
//===-- ubsan_monitor.h -----------------------------------------*- C++ -*-===//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// Hooks which allow a monitor process to inspect UBSan's diagnostics.9//10//===----------------------------------------------------------------------===//1112#ifndef UBSAN_MONITOR_H13#define UBSAN_MONITOR_H1415#include "ubsan_diag.h"16#include "ubsan_value.h"1718namespace __ubsan {1920struct UndefinedBehaviorReport {21const char *IssueKind;22Location &Loc;23InternalScopedString Buffer;2425UndefinedBehaviorReport(const char *IssueKind, Location &Loc,26InternalScopedString &Msg);27};2829SANITIZER_INTERFACE_ATTRIBUTE void30RegisterUndefinedBehaviorReport(UndefinedBehaviorReport *UBR);3132/// Called after a report is prepared. This serves to alert monitor processes33/// that a UB report is available.34extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __ubsan_on_report(void);3536/// Used by the monitor process to extract information from a UB report. The37/// data is only available until the next time __ubsan_on_report is called. The38/// caller is responsible for copying and preserving the data if needed.39extern "C" SANITIZER_INTERFACE_ATTRIBUTE void40__ubsan_get_current_report_data(const char **OutIssueKind,41const char **OutMessage,42const char **OutFilename, unsigned *OutLine,43unsigned *OutCol, char **OutMemoryAddr);4445} // end namespace __ubsan4647#endif // UBSAN_MONITOR_H484950