1 //===-- ubsan_monitor.h -----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Hooks which allow a monitor process to inspect UBSan's diagnostics.
12 //===----------------------------------------------------------------------===//
14 #ifndef UBSAN_MONITOR_H
15 #define UBSAN_MONITOR_H
17 #include "ubsan_diag.h"
18 #include "ubsan_value.h"
22 struct UndefinedBehaviorReport {
23 const char *IssueKind;
25 InternalScopedString Buffer;
27 UndefinedBehaviorReport(const char *IssueKind, Location &Loc,
28 InternalScopedString &Msg);
31 SANITIZER_INTERFACE_ATTRIBUTE void
32 RegisterUndefinedBehaviorReport(UndefinedBehaviorReport *UBR);
34 /// Called after a report is prepared. This serves to alert monitor processes
35 /// that a UB report is available.
36 extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __ubsan_on_report(void);
38 /// Used by the monitor process to extract information from a UB report. The
39 /// data is only available until the next time __ubsan_on_report is called. The
40 /// caller is responsible for copying and preserving the data if needed.
41 extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
42 __ubsan_get_current_report_data(const char **OutIssueKind,
43 const char **OutMessage,
44 const char **OutFilename, unsigned *OutLine,
45 unsigned *OutCol, char **OutMemoryAddr);
47 } // end namespace __ubsan
49 #endif // UBSAN_MONITOR_H