  
  echo "[+] Build process successful!"
  
-@@ -150,37 +150,85 @@
+@@ -150,37 +150,73 @@
  cd ..
  ls -l ../afl-qemu-trace || exit 1
  

--- /home/nick/Projects/junk/safe/afl-1.83b/qemu_mode/build_qemu_support.sh	2015-04-29 20:34:59.000000000 -0700
+++ build_qemu_support.sh	2015-07-20 16:25:11.133153055 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # american fuzzy lop - QEMU build script
 # --------------------------------------
@@ -139,7 +139,7 @@
 
 echo "[*] Attempting to build QEMU (fingers crossed!)..."

+git -C $QEMU_DIR checkout afl || exit 1
+git -C $QEMU_DIR pull || exit 1
+echo "[+] Checked out."
+
+echo "[*] Attempting to merge in driller's changes"
 
-echo "[*] Testing the build..."
+echo "[*] Configuring QEMU..."
 
-cd ..
-
-make >/dev/null || exit 1
+cd $QEMU_DIR || exit 1
 
-gcc test-instr.c -o test-instr || exit 1
+./cgc_configure_opt
 
-unset AFL_INST_RATIO
+echo "[+] Configuration complete."
 
-echo 0 | ./afl-showmap -m none -Q -q -o .test-instr0 ./test-instr || exit 1
-echo 1 | ./afl-showmap -m none -Q -q -o .test-instr1 ./test-instr || exit 1
-
-rm -f test-instr
+echo "[*] Attempting to build QEMU (fingers crossed!)..."
 
-cmp -s .test-instr0 .test-instr1
-DR="$?"
+make -j || exit 1
 
-rm -f .test-instr0 .test-instr1
+echo "[+] Build process successful!"
 
-if [ "$DR" = "0" ]; then
+echo "[*] Copying binary..."
 
-  echo "[-] Error: afl-qemu-trace instrumentation doesn't seem to work!"
-  exit 1
+cp -f "i386-linux-user/qemu-i386" "../../afl-qemu-trace-cgc" || exit 1
 
-fi
+cd ..
+ls -l ../afl-qemu-trace-cgc || exit 1
 
