Index: lldb/trunk/lit/Driver/Inputs/process_attach_pid.in =================================================================== --- lldb/trunk/lit/Driver/Inputs/process_attach_pid.in +++ lldb/trunk/lit/Driver/Inputs/process_attach_pid.in @@ -0,0 +1 @@ +process attach --pid Index: lldb/trunk/lit/Driver/TestProcessAttach.test =================================================================== --- lldb/trunk/lit/Driver/TestProcessAttach.test +++ lldb/trunk/lit/Driver/TestProcessAttach.test @@ -0,0 +1,2 @@ +# RUN: %lldb -x -b -S %S/Inputs/process_attach_pid.in 2>&1 | FileCheck %s +# CHECK: requires an argument Index: lldb/trunk/source/Interpreter/Options.cpp =================================================================== --- lldb/trunk/source/Interpreter/Options.cpp +++ lldb/trunk/source/Interpreter/Options.cpp @@ -1362,6 +1362,12 @@ int long_options_index = -1; val = OptionParser::Parse(argv.size(), &*argv.begin(), sstr.GetString(), long_options, &long_options_index); + + if ((size_t)OptionParser::GetOptionIndex() > argv.size()) { + error.SetErrorStringWithFormat("option requires an argument"); + break; + } + if (val == -1) break;