diff --git a/binary_info.h b/binary_info.h index f0cf114..51679bd 100644 --- a/binary_info.h +++ b/binary_info.h @@ -24,11 +24,11 @@ namespace centipede { // Information about the binary being fuzzed. Created once at program startup // and doesn't change (other than for lazily initialized fields) struct BinaryInfo { - PCTable pc_table; - SymbolTable symbols; - CFTable cf_table; - ControlFlowGraph control_flow_graph; - CallGraph call_graph; + PCTable &pc_table; + SymbolTable &symbols; + CFTable &cf_table; + ControlFlowGraph &control_flow_graph; + CallGraph &call_graph; }; } // namespace centipede diff --git a/centipede_interface.cc b/centipede_interface.cc index 50bb988..c0f7063 100644 --- a/centipede_interface.cc +++ b/centipede_interface.cc @@ -175,7 +175,14 @@ int CentipedeMain(const Environment &env, RemoteMkdir(env.MakeCoverageDirPath()); auto one_time_callbacks = callbacks_factory.create(env); - BinaryInfo binary_info; + PCTable pct; + CFTable cft; + SymbolTable st; + ControlFlowGraph cfg; + CallGraph cg; + BinaryInfo binary_info = {pct, st, cft, cfg, cg}; + // TODO(navidem): Better to load binary_info contents and use those for + // initialization. one_time_callbacks->PopulateBinaryInfo(binary_info); callbacks_factory.destroy(one_time_callbacks); diff --git a/corpus_test.cc b/corpus_test.cc index 6d0e250..528c430 100644 --- a/corpus_test.cc +++ b/corpus_test.cc @@ -24,6 +24,7 @@ #include "./coverage.h" #include "./defs.h" #include "./feature.h" +#include "./symbol_table.h" #include "./util.h" namespace centipede { @@ -154,7 +155,10 @@ TEST(FeatureSet, CountUnseenAndPruneFrequentFeatures_IncrementFrequencies) { TEST(Corpus, GetCmpArgs) { PCTable pc_table(100); CFTable cf_table(100); - CoverageFrontier coverage_frontier({pc_table, {}, cf_table, {}, {}}); + SymbolTable sym; + ControlFlowGraph cfg; + CallGraph cg; + CoverageFrontier coverage_frontier({pc_table, sym, cf_table, cfg, cg}); FeatureSet fs(3); Corpus corpus; ByteArray cmp_args{2, 0, 1, 2, 3}; @@ -168,7 +172,10 @@ TEST(Corpus, GetCmpArgs) { TEST(Corpus, PrintStats) { PCTable pc_table(100); CFTable cf_table(100); - CoverageFrontier coverage_frontier({pc_table, {}, cf_table, {}, {}}); + SymbolTable sym; + ControlFlowGraph cfg; + CallGraph cg; + CoverageFrontier coverage_frontier({pc_table, sym, cf_table, cfg, cg}); FeatureSet fs(3); Corpus corpus; FeatureVec features1 = {10, 20, 30}; @@ -189,7 +196,10 @@ TEST(Corpus, Prune) { // Prune will remove an input if all of its features appear at least 3 times. PCTable pc_table(100); CFTable cf_table(100); - CoverageFrontier coverage_frontier({pc_table, {}, cf_table, {}, {}}); + SymbolTable sym; + ControlFlowGraph cfg; + CallGraph cg; + CoverageFrontier coverage_frontier({pc_table, sym, cf_table, cfg, cg}); FeatureSet fs(3); Corpus corpus; Rng rng(0); @@ -247,7 +257,10 @@ TEST(Corpus, Prune) { TEST(Corpus, PruneRegressionTest1) { PCTable pc_table(100); CFTable cf_table(100); - CoverageFrontier coverage_frontier({pc_table, {}, cf_table, {}, {}}); + SymbolTable sym; + ControlFlowGraph cfg; + CallGraph cg; + CoverageFrontier coverage_frontier({pc_table, sym, cf_table, cfg, cg}); FeatureSet fs(2); Corpus corpus; Rng rng(0); @@ -413,7 +426,8 @@ TEST(CoverageFrontier, Compute) { ControlFlowGraph cfg(cf_table, pc_table); CallGraph call_graph(cf_table, pc_table); - BinaryInfo bin_info = {pc_table, {}, cf_table, cfg, call_graph}; + SymbolTable sym; + BinaryInfo bin_info = {pc_table, sym, cf_table, cfg, call_graph}; CoverageFrontier frontier(bin_info); FeatureVec pcs(pc_table.size()); @@ -492,8 +506,8 @@ TEST(CoverageFrontierDeath, InvalidIndexToFrontier) { ControlFlowGraph cfg(cf_table, pc_table); CallGraph call_graph(cf_table, pc_table); - - BinaryInfo bin_info = {pc_table, {}, cf_table, cfg, call_graph}; + SymbolTable sym; + BinaryInfo bin_info = {pc_table, sym, cf_table, cfg, call_graph}; CoverageFrontier frontier(bin_info); Corpus corpus;