mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-08 16:21:32 +00:00
give document edge id a unique id per module
This commit is contained in:
parent
44060590b4
commit
e6e38d1703
@ -437,7 +437,7 @@ inline static u32 __afl_next_testcase(u8 *buf, u32 max_len) {
|
||||
if (write(FORKSRV_FD + 1, &pid, 4) != 4) do_exit = 1;
|
||||
// fprintf(stderr, "write1 %d\n", do_exit);
|
||||
|
||||
__afl_area_ptr[0] = 1; // put something in the map
|
||||
__afl_area_ptr[0] = 1; // put something in the map
|
||||
|
||||
return status;
|
||||
|
||||
|
@ -105,6 +105,11 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
||||
char * ptr;
|
||||
FILE * documentFile = NULL;
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
unsigned long long int moduleID =
|
||||
(((unsigned long long int)(rand() & 0xffffffff)) << 32) | getpid();
|
||||
|
||||
IntegerType *Int8Ty = IntegerType::getInt8Ty(C);
|
||||
IntegerType *Int32Ty = IntegerType::getInt32Ty(C);
|
||||
IntegerType *Int64Ty = IntegerType::getInt64Ty(C);
|
||||
@ -189,13 +194,32 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
||||
ConstantInt *Zero = ConstantInt::get(Int8Ty, 0);
|
||||
ConstantInt *One = ConstantInt::get(Int8Ty, 1);
|
||||
|
||||
/* This dumps all inialized global strings - might be useful in the future
|
||||
for (auto G=M.getGlobalList().begin(); G!=M.getGlobalList().end(); G++) {
|
||||
|
||||
GlobalVariable &GV=*G;
|
||||
if (!GV.getName().str().empty()) {
|
||||
|
||||
fprintf(stderr, "Global Variable: %s", GV.getName().str().c_str());
|
||||
if (GV.hasInitializer())
|
||||
if (auto *Val = dyn_cast<ConstantDataArray>(GV.getInitializer()))
|
||||
fprintf(stderr, " Value: \"%s\"", Val->getAsString().str().c_str());
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* Instrument all the things! */
|
||||
|
||||
int inst_blocks = 0;
|
||||
|
||||
for (auto &F : M) {
|
||||
|
||||
// fprintf(stderr, "DEBUG: Function %s\n", F.getName().str().c_str());
|
||||
// fprintf(stderr, "DEBUG: Module %s Function %s\n",
|
||||
// M.getName().str().c_str(), F.getName().str().c_str());
|
||||
|
||||
if (F.size() < function_minimum_size) continue;
|
||||
if (isIgnoreFunction(&F)) continue;
|
||||
@ -603,8 +627,8 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
||||
|
||||
if (documentFile) {
|
||||
|
||||
fprintf(documentFile, "%s %u\n", F.getName().str().c_str(),
|
||||
afl_global_id);
|
||||
fprintf(documentFile, "ModuleID=%llu Function=%s edgeID=%u\n",
|
||||
moduleID, F.getName().str().c_str(), afl_global_id);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user