• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- FuzzerExtFunctions.def - External functions --------------*- 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// This defines the external function pointers that
10// ``fuzzer::ExternalFunctions`` should contain and try to initialize.  The
11// EXT_FUNC macro must be defined at the point of inclusion. The signature of
12// the macro is:
13//
14// EXT_FUNC(<name>, <return_type>, <function_signature>, <warn_if_missing>)
15//===----------------------------------------------------------------------===//
16
17// Optional user functions
18EXT_FUNC(LLVMFuzzerInitialize, int, (int *argc, char ***argv), false);
19EXT_FUNC(LLVMFuzzerCustomMutator, size_t,
20         (uint8_t * Data, size_t Size, size_t MaxSize, unsigned int Seed),
21         false);
22EXT_FUNC(LLVMFuzzerCustomCrossOver, size_t,
23         (const uint8_t * Data1, size_t Size1,
24          const uint8_t * Data2, size_t Size2,
25          uint8_t * Out, size_t MaxOutSize, unsigned int Seed),
26         false);
27
28// Sanitizer functions
29EXT_FUNC(__lsan_enable, void, (), false);
30EXT_FUNC(__lsan_disable, void, (), false);
31EXT_FUNC(__lsan_do_recoverable_leak_check, int, (), false);
32EXT_FUNC(__sanitizer_get_number_of_counters, size_t, (), false);
33EXT_FUNC(__sanitizer_install_malloc_and_free_hooks, int,
34         (void (*malloc_hook)(const volatile void *, size_t),
35          void (*free_hook)(const volatile void *)),
36         false);
37EXT_FUNC(__sanitizer_get_total_unique_caller_callee_pairs, size_t, (), false);
38EXT_FUNC(__sanitizer_get_total_unique_coverage, size_t, (), true);
39EXT_FUNC(__sanitizer_print_memory_profile, int, (size_t), false);
40EXT_FUNC(__sanitizer_print_stack_trace, void, (), true);
41EXT_FUNC(__sanitizer_symbolize_pc, void,
42         (void *, const char *fmt, char *out_buf, size_t out_buf_size), false);
43EXT_FUNC(__sanitizer_get_module_and_offset_for_pc, int,
44         (void *pc, char *module_path,
45         size_t module_path_len,void **pc_offset), false);
46EXT_FUNC(__sanitizer_reset_coverage, void, (), true);
47EXT_FUNC(__sanitizer_set_death_callback, void, (void (*)(void)), true);
48EXT_FUNC(__sanitizer_set_report_fd, void, (void*), false);
49EXT_FUNC(__sanitizer_update_counter_bitset_and_clear_counters, uintptr_t,
50  (uint8_t*), false);
51