Bitcoin Core  22.99.0
P2P Digital Currency
Functions | Variables
fuzz.cpp File Reference
#include <test/fuzz/fuzz.h>
#include <netaddress.h>
#include <netbase.h>
#include <test/util/setup_common.h>
#include <util/check.h>
#include <util/sock.h>
#include <cstdint>
#include <exception>
#include <functional>
#include <memory>
#include <string>
#include <unistd.h>
#include <vector>
Include dependency graph for fuzz.cpp:

Go to the source code of this file.

Functions

static void SetArgs (int argc, char **argv)
 
std::map< std::string_view, std::tuple< TypeTestOneInput, TypeInitialize, TypeHidden > > & FuzzTargets ()
 
void FuzzFrameworkRegisterTarget (std::string_view name, TypeTestOneInput target, TypeInitialize init, TypeHidden hidden)
 
void initialize ()
 
int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
 
int LLVMFuzzerInitialize (int *argc, char ***argv)
 

Variables

const std::function< void(const std::string &)> G_TEST_LOG_FUN {}
 This is connected to the logger. More...
 
static std::vector< const char * > g_args
 A copy of the command line arguments that start with --. More...
 
const std::function< std::vector< const char * >)> G_TEST_COMMAND_LINE_ARGUMENTS
 Retrieve the command line arguments. More...
 
static TypeTestOneInputg_test_one_input {nullptr}
 

Function Documentation

◆ FuzzFrameworkRegisterTarget()

void FuzzFrameworkRegisterTarget ( std::string_view  name,
TypeTestOneInput  target,
TypeInitialize  init,
TypeHidden  hidden 
)

Definition at line 52 of file fuzz.cpp.

Here is the call graph for this function:

◆ FuzzTargets()

std::map<std::string_view, std::tuple<TypeTestOneInput, TypeInitialize, TypeHidden> >& FuzzTargets ( )

Definition at line 46 of file fuzz.cpp.

Here is the caller graph for this function:

◆ initialize()

void initialize ( )

Definition at line 60 of file fuzz.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LLVMFuzzerInitialize()

int LLVMFuzzerInitialize ( int *  argc,
char ***  argv 
)

Definition at line 120 of file fuzz.cpp.

Here is the call graph for this function:

◆ LLVMFuzzerTestOneInput()

int LLVMFuzzerTestOneInput ( const uint8_t *  data,
size_t  size 
)

Definition at line 112 of file fuzz.cpp.

◆ SetArgs()

static void SetArgs ( int  argc,
char **  argv 
)
static

Definition at line 32 of file fuzz.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ g_args

std::vector<const char*> g_args
static

A copy of the command line arguments that start with --.

First LLVMFuzzerInitialize() is called, which saves the arguments to g_args. Later, depending on the fuzz test, G_TEST_COMMAND_LINE_ARGUMENTS() may be called by BasicTestingSetup constructor to fetch those arguments and store them in BasicTestingSetup::m_node::args.

Definition at line 30 of file fuzz.cpp.

◆ G_TEST_COMMAND_LINE_ARGUMENTS

const std::function<std::vector<const char*>)> G_TEST_COMMAND_LINE_ARGUMENTS
Initial value:
= []() {
return g_args;
}

Retrieve the command line arguments.

Definition at line 42 of file fuzz.cpp.

◆ G_TEST_LOG_FUN

const std::function<void(const std::string&)> G_TEST_LOG_FUN {}

This is connected to the logger.

Can be used to redirect logs to any other log

Definition at line 21 of file fuzz.cpp.

◆ g_test_one_input

TypeTestOneInput* g_test_one_input {nullptr}
static

Definition at line 58 of file fuzz.cpp.

g_args
static std::vector< const char * > g_args
A copy of the command line arguments that start with --.
Definition: fuzz.cpp:30