[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 08/14] fuzz/x86_emulate: Add 'afl-cov' target



On 09/15/2017 01:57 PM, Wei Liu wrote:
> On Fri, Aug 25, 2017 at 05:43:37PM +0100, George Dunlap wrote:
>> diff --git a/tools/fuzz/x86_instruction_emulator/Makefile 
>> b/tools/fuzz/x86_instruction_emulator/Makefile
>> index 10009dc08f..629e191029 100644
>> --- a/tools/fuzz/x86_instruction_emulator/Makefile
>> +++ b/tools/fuzz/x86_instruction_emulator/Makefile
>> @@ -23,19 +23,33 @@ x86_emulate_user.c x86_emulate_user.h: %:
>>  
>>  CFLAGS += $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -I.
>>  
>> +GCOV_FLAGS=--coverage
>> +
>>  x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
>>  x86_emulate.h := x86_emulate_user.h x86_emulate/x86_emulate.h $(x86.h)
>>  
>>  x86_emulate_user.o: x86_emulate_user.c x86_emulate/x86_emulate.c 
>> $(x86_emulate.h)
>>  
>> +x86_emulate_user-cov.o: x86_emulate_user.c x86_emulate/x86_emulate.c 
>> $(x86_emulate.h)
>> +    $(CC) -c $(CFLAGS) $(GCOV_FLAGS) -o $@ x86_emulate_user.c
>> +
>>  fuzz-emul.o: $(x86_emulate.h)
>>  
>> +fuzz-emul-cov.o: fuzz-emul.c $(x86_emulate.h)
>> +    $(CC) -c $(CFLAGS) $(GCOV_FLAGS) -o $@ fuzz-emul.c
>> +
>> +afl-harness-cov.o: afl-harness.c
>> +    $(CC) -c $(CFLAGS) $(GCOV_FLAGS) $^ -o $@
>> +
>>  x86-insn-fuzzer.a: fuzz-emul.o x86_emulate_user.o
>>      $(AR) rc $@ $^
>>  
>>  afl-harness: afl-harness.o fuzz-emul.o x86_emulate_user.o
>>      $(CC) $(CFLAGS) $^ -o $@
>>  
>> +afl-harness-cov: afl-harness-cov.o fuzz-emul-cov.o x86_emulate_user-cov.o
>> +    $(CC) $(CFLAGS) $(GCOV_FLAGS) $^ -o $@
>> +
> 
> Also it is possible to use pattern rules to simplify targets. But given
> this is a rather small program I won't insist on using using pattern
> rules.

Indeed, a previous incarnation of this patch actually had such rules;
but it seemed a bit heavy-handed.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.