blob: 3bc5302c31c63e03ef3199888b0641af22dd2f90 [file] [log] [blame]
Dan Liewd3c33112016-06-02 05:48:02 +00001//===- 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);
Mike Aizatsky41d66832016-06-07 20:22:15 +000022EXT_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);
Dan Liewd3c33112016-06-02 05:48:02 +000027
Dan Liew1873a492016-06-07 23:32:50 +000028// Sanitizer functions
29EXT_FUNC(__lsan_enable, void, (), false);
30EXT_FUNC(__lsan_disable, void, (), false);
31EXT_FUNC(__lsan_do_recoverable_leak_check, int, (), false);
Kostya Serebryanyfd6ad5b2016-06-16 20:17:41 +000032EXT_FUNC(__sanitizer_install_malloc_and_free_hooks, int,
33 (void (*malloc_hook)(const volatile void *, size_t),
34 void (*free_hook)(const volatile void *)),
35 false);
Kostya Serebryany6d541252017-03-15 23:27:53 +000036EXT_FUNC(__sanitizer_print_memory_profile, int, (size_t, size_t), false);
Dan Liew1873a492016-06-07 23:32:50 +000037EXT_FUNC(__sanitizer_print_stack_trace, void, (), true);
Kostya Serebryany0f0fa4f2016-08-25 22:35:08 +000038EXT_FUNC(__sanitizer_symbolize_pc, void,
39 (void *, const char *fmt, char *out_buf, size_t out_buf_size), false);
Kostya Serebryany1394ce22016-12-10 01:19:35 +000040EXT_FUNC(__sanitizer_get_module_and_offset_for_pc, int,
41 (void *pc, char *module_path,
42 size_t module_path_len,void **pc_offset), false);
Dan Liew1873a492016-06-07 23:32:50 +000043EXT_FUNC(__sanitizer_set_death_callback, void, (void (*)(void)), true);
44EXT_FUNC(__sanitizer_set_report_fd, void, (void*), false);
Kostya Serebryanyeee8b4a2017-01-20 23:35:29 +000045EXT_FUNC(__sanitizer_dump_coverage, void, (const uintptr_t *, uintptr_t),
46 false);