[llvm-mc-fuzzer] Fix -jobs option.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Sat, 26 Sep 2015 17:09:01 +0000 (17:09 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Sat, 26 Sep 2015 17:09:01 +0000 (17:09 +0000)
The fuzzer argument parser will ignore all options starting with '--' so
operation mode options should begin with '--' and fuzzer options should begin
with '-'. Fuzzer arguments must still follow --fuzzer-args so that they escape
the parsing performed by the CommandLine library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248671 91177308-0d34-0410-b5e6-96231b3b80d8

docs/LibFuzzer.rst
tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp

index 8d4972296edef4a2d807a86616949e443e549a7d..a5114bbf08336519c7a917c1ced696c8112eca34 100644 (file)
@@ -361,11 +361,12 @@ When run in dissassembly mode, the inputs are opcodes to be disassembled. The
 fuzzer will consume as many instructions as possible and will stop when it
 finds an invalid instruction or runs out of data.
 
-Please note that the command line interface differs from that of other fuzzers.
-The fuzzer arguments are specified with ``-fuzzer-args`` while other arguments
-control the operation mode and target in a similar manner to ``llvm-mc``.
+Please note that the command line interface differs slightly from that of other
+fuzzers. The fuzzer arguments should follow ``--fuzzer-args`` and should have
+a single dash, while other arguments control the operation mode and target in a
+similar manner to ``llvm-mc`` and should have two dashes. For example::
 
-Unfortunately, this fuzzer is currently unable to use the -jobs option.
+  llvm-mc-fuzzer --triple=aarch64-linux-gnu --disassemble --fuzzer-args -max_len=4 -jobs=10
 
 Buildbot
 --------
index f2bbe4f1af3a6bdb15d9d0f3b7e0b08e25e155b6..7710f80985dd2281df43195fe7dcfd750cf94590 100644 (file)
@@ -127,13 +127,10 @@ int main(int argc, char **argv) {
     FeaturesStr = Features.getString();
   }
 
-  // Insert the program name into the FuzzerArgv.
-  FuzzerArgv.insert(FuzzerArgv.begin(), argv[0]);
-
   if (Action == AC_Assemble)
     errs() << "error: -assemble is not implemented\n";
   else if (Action == AC_Disassemble)
-    return fuzzer::FuzzerDriver(FuzzerArgv, DisassembleOneInput);
+    return fuzzer::FuzzerDriver(argc, argv, DisassembleOneInput);
 
   llvm_unreachable("Unknown action");
   return 1;