[DAG] Fix typo in VSELECT SimplifyDemandedVectorElts handling. NFC.
[llvm-project.git] / lldb / source / Commands / CommandOptionsProcessAttach.cpp
blobd3d864dfe0255610a89d8ebeb1d0e94547d8ae59
1 //===-- CommandOptionsProcessAttach.cpp -----------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "CommandOptionsProcessAttach.h"
11 #include "lldb/Host/FileSystem.h"
12 #include "lldb/Host/HostInfo.h"
13 #include "lldb/Host/OptionParser.h"
14 #include "lldb/Interpreter/CommandCompletions.h"
15 #include "lldb/Interpreter/CommandObject.h"
16 #include "lldb/Interpreter/CommandOptionArgumentTable.h"
17 #include "lldb/Interpreter/OptionArgParser.h"
18 #include "lldb/Target/ExecutionContext.h"
19 #include "lldb/Target/Platform.h"
20 #include "lldb/Target/Target.h"
22 #include "llvm/ADT/ArrayRef.h"
24 using namespace llvm;
25 using namespace lldb;
26 using namespace lldb_private;
28 #define LLDB_OPTIONS_process_attach
29 #include "CommandOptions.inc"
31 Status CommandOptionsProcessAttach::SetOptionValue(
32 uint32_t option_idx, llvm::StringRef option_arg,
33 ExecutionContext *execution_context) {
34 Status error;
35 const int short_option = g_process_attach_options[option_idx].short_option;
36 switch (short_option) {
37 case 'c':
38 attach_info.SetContinueOnceAttached(true);
39 break;
41 case 'p': {
42 lldb::pid_t pid;
43 if (option_arg.getAsInteger(0, pid)) {
44 error.SetErrorStringWithFormat("invalid process ID '%s'",
45 option_arg.str().c_str());
46 } else {
47 attach_info.SetProcessID(pid);
49 } break;
51 case 'P':
52 attach_info.SetProcessPluginName(option_arg);
53 break;
55 case 'n':
56 attach_info.GetExecutableFile().SetFile(option_arg,
57 FileSpec::Style::native);
58 break;
60 case 'w':
61 attach_info.SetWaitForLaunch(true);
62 break;
64 case 'i':
65 attach_info.SetIgnoreExisting(false);
66 break;
68 default:
69 llvm_unreachable("Unimplemented option");
71 return error;
74 llvm::ArrayRef<OptionDefinition> CommandOptionsProcessAttach::GetDefinitions() {
75 return llvm::ArrayRef(g_process_attach_options);