[llvm] r248671 - [llvm-mc-fuzzer] Fix -jobs option.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 26 10:09:02 PDT 2015

Author: dsanders
Date: Sat Sep 26 12:09:01 2015
New Revision: 248671

URL: http://llvm.org/viewvc/llvm-project?rev=248671&view=rev
[llvm-mc-fuzzer] Fix -jobs option.

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.


Modified: llvm/trunk/docs/LibFuzzer.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LibFuzzer.rst?rev=248671&r1=248670&r2=248671&view=diff
--- llvm/trunk/docs/LibFuzzer.rst (original)
+++ llvm/trunk/docs/LibFuzzer.rst Sat Sep 26 12:09:01 2015
@@ -361,11 +361,12 @@ When run in dissassembly mode, the input
 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

Modified: llvm/trunk/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp?rev=248671&r1=248670&r2=248671&view=diff
--- llvm/trunk/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp (original)
+++ llvm/trunk/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp Sat Sep 26 12:09:01 2015
@@ -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;

More information about the llvm-commits mailing list