LLDB mainline
CommandOptionsProcessAttach.cpp
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
8
10
12#include "lldb/Host/HostInfo.h"
20#include "lldb/Target/Target.h"
21
22#include "llvm/ADT/ArrayRef.h"
23
24using namespace llvm;
25using namespace lldb;
26using namespace lldb_private;
27
28#define LLDB_OPTIONS_process_attach
29#include "CommandOptions.inc"
30
32 uint32_t option_idx, llvm::StringRef option_arg,
33 ExecutionContext *execution_context) {
35 const int short_option = g_process_attach_options[option_idx].short_option;
36 switch (short_option) {
37 case 'c':
39 break;
40
41 case 'p': {
42 lldb::pid_t pid;
43 if (option_arg.getAsInteger(0, pid)) {
44 return Status::FromErrorStringWithFormatv("invalid process ID '{0}'",
45 option_arg);
46 } else {
48 }
49 } break;
50
51 case 'P':
53 break;
54
55 case 'n':
57 FileSpec::Style::native);
58 break;
59
60 case 'w':
62 break;
63
64 case 'i':
66 break;
67
68 default:
69 llvm_unreachable("Unimplemented option");
70 }
71 return error;
72}
73
74llvm::ArrayRef<OptionDefinition> CommandOptionsProcessAttach::GetDefinitions() {
75 return llvm::ArrayRef(g_process_attach_options);
76}
static llvm::raw_ostream & error(Stream &strm)
llvm::ArrayRef< lldb_private::OptionDefinition > GetDefinitions() override
lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, lldb_private::ExecutionContext *execution_context) override
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
Definition: FileSpec.cpp:174
void SetContinueOnceAttached(bool b)
Definition: Process.h:152
void SetProcessPluginName(llvm::StringRef plugin)
Definition: Process.h:162
void SetIgnoreExisting(bool b)
Definition: Process.h:148
void SetProcessID(lldb::pid_t pid)
Definition: ProcessInfo.h:70
FileSpec & GetExecutableFile()
Definition: ProcessInfo.h:43
An error handling class.
Definition: Status.h:115
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition: Status.h:148
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
uint64_t pid_t
Definition: lldb-types.h:83
Definition: Debugger.h:54