From 0ff0eb0687f97d56ad1a5bc57fd65a1578a303e9 Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Sat, 26 Sep 2015 17:09:01 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248671 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LibFuzzer.rst | 9 +++++---- tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp | 5 +---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/LibFuzzer.rst b/docs/LibFuzzer.rst index 8d4972296ed..a5114bbf083 100644 --- a/docs/LibFuzzer.rst +++ b/docs/LibFuzzer.rst @@ -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 -------- diff --git a/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp b/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp index f2bbe4f1af3..7710f80985d 100644 --- a/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp +++ b/tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp @@ -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; -- 2.34.1