LLDB
mainline
llvm-project
lldb
source
Commands
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
9
#include "
CommandOptionsProcessAttach.h
"
10
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
"
21
22
#include "llvm/ADT/ArrayRef.h"
23
24
using namespace
llvm
;
25
using namespace
lldb
;
26
using namespace
lldb_private
;
27
28
#define LLDB_OPTIONS_process_attach
29
#include "CommandOptions.inc"
30
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
;
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
{
47
attach_info
.
SetProcessID
(pid);
48
}
49
}
break
;
50
51
case
'P'
:
52
attach_info
.
SetProcessPluginName
(option_arg);
53
break
;
54
55
case
'n'
:
56
attach_info
.
GetExecutableFile
().
SetFile
(option_arg,
57
FileSpec::Style::native);
58
break
;
59
60
case
'w'
:
61
attach_info
.
SetWaitForLaunch
(
true
);
62
break
;
63
64
case
'i'
:
65
attach_info
.
SetIgnoreExisting
(
false
);
66
break
;
67
68
default
:
69
llvm_unreachable(
"Unimplemented option"
);
70
}
71
return
error
;
72
}
73
74
llvm::ArrayRef<OptionDefinition>
CommandOptionsProcessAttach::GetDefinitions
() {
75
return
llvm::ArrayRef(g_process_attach_options);
76
}
CommandCompletions.h
CommandObject.h
CommandOptionArgumentTable.h
CommandOptionsProcessAttach.h
error
static llvm::raw_ostream & error(Stream &strm)
Definition:
CommandReturnObject.cpp:18
ExecutionContext.h
FileSystem.h
HostInfo.h
OptionArgParser.h
OptionParser.h
Platform.h
Target.h
lldb_private::CommandOptionsProcessAttach::GetDefinitions
llvm::ArrayRef< lldb_private::OptionDefinition > GetDefinitions() override
Definition:
CommandOptionsProcessAttach.cpp:74
lldb_private::CommandOptionsProcessAttach::attach_info
lldb_private::ProcessAttachInfo attach_info
Definition:
CommandOptionsProcessAttach.h:42
lldb_private::CommandOptionsProcessAttach::SetOptionValue
lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, lldb_private::ExecutionContext *execution_context) override
Definition:
CommandOptionsProcessAttach.cpp:31
lldb_private::ExecutionContext
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Definition:
ExecutionContext.h:292
lldb_private::FileSpec::SetFile
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
Definition:
FileSpec.cpp:174
lldb_private::ProcessAttachInfo::SetContinueOnceAttached
void SetContinueOnceAttached(bool b)
Definition:
Process.h:152
lldb_private::ProcessAttachInfo::SetWaitForLaunch
void SetWaitForLaunch(bool b)
Definition:
Process.h:140
lldb_private::ProcessAttachInfo::SetProcessPluginName
void SetProcessPluginName(llvm::StringRef plugin)
Definition:
Process.h:162
lldb_private::ProcessAttachInfo::SetIgnoreExisting
void SetIgnoreExisting(bool b)
Definition:
Process.h:148
lldb_private::ProcessInfo::SetProcessID
void SetProcessID(lldb::pid_t pid)
Definition:
ProcessInfo.h:70
lldb_private::ProcessInfo::GetExecutableFile
FileSpec & GetExecutableFile()
Definition:
ProcessInfo.h:43
lldb_private::Status
An error handling class.
Definition:
Status.h:115
lldb_private::Status::FromErrorStringWithFormatv
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition:
Status.h:148
lldb_private
A class that represents a running process on the host machine.
Definition:
SBAddressRange.h:14
lldb
Definition:
SBAddress.h:15
lldb::pid_t
uint64_t pid_t
Definition:
lldb-types.h:83
llvm
Definition:
Debugger.h:54
Generated on Fri Dec 20 2024 17:27:05 for LLDB by
1.9.6