Home | History | Annotate | Download | only in sanitizer_common
      1 //===-- sanitizer_interface_internal.h --------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file is shared between run-time libraries of sanitizers.
     11 //
     12 // This header declares the sanitizer runtime interface functions.
     13 // The runtime library has to define these functions so the instrumented program
     14 // could call them.
     15 //
     16 // See also include/sanitizer/common_interface_defs.h
     17 //===----------------------------------------------------------------------===//
     18 #ifndef SANITIZER_INTERFACE_INTERNAL_H
     19 #define SANITIZER_INTERFACE_INTERNAL_H
     20 
     21 #include "sanitizer_internal_defs.h"
     22 
     23 extern "C" {
     24   // Tell the tools to write their reports to "path.<pid>" instead of stderr.
     25   // The special values are "stdout" and "stderr".
     26   SANITIZER_INTERFACE_ATTRIBUTE
     27   void __sanitizer_set_report_path(const char *path);
     28   // Tell the tools to write their reports to the provided file descriptor
     29   // (casted to void *).
     30   SANITIZER_INTERFACE_ATTRIBUTE
     31   void __sanitizer_set_report_fd(void *fd);
     32 
     33   typedef struct {
     34       int coverage_sandboxed;
     35       __sanitizer::sptr coverage_fd;
     36       unsigned int coverage_max_block_size;
     37   } __sanitizer_sandbox_arguments;
     38 
     39   // Notify the tools that the sandbox is going to be turned on.
     40   SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE void
     41       __sanitizer_sandbox_on_notify(__sanitizer_sandbox_arguments *args);
     42 
     43   // This function is called by the tool when it has just finished reporting
     44   // an error. 'error_summary' is a one-line string that summarizes
     45   // the error message. This function can be overridden by the client.
     46   SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
     47   void __sanitizer_report_error_summary(const char *error_summary);
     48 
     49   SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_dump();
     50   SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_init();
     51   SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov(__sanitizer::u32 *guard);
     52   SANITIZER_INTERFACE_ATTRIBUTE
     53   void __sanitizer_annotate_contiguous_container(const void *beg,
     54                                                  const void *end,
     55                                                  const void *old_mid,
     56                                                  const void *new_mid);
     57   SANITIZER_INTERFACE_ATTRIBUTE
     58   int __sanitizer_verify_contiguous_container(const void *beg, const void *mid,
     59                                               const void *end);
     60   SANITIZER_INTERFACE_ATTRIBUTE
     61   const void *__sanitizer_contiguous_container_find_bad_address(
     62       const void *beg, const void *mid, const void *end);
     63   } // extern "C"
     64 
     65 #endif  // SANITIZER_INTERFACE_INTERNAL_H
     66