LLDB
mainline
llvm-project
lldb
source
Interpreter
OptionGroupOutputFile.cpp
Go to the documentation of this file.
1
//===-- OptionGroupOutputFile.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 "
lldb/Interpreter/OptionGroupOutputFile.h
"
10
11
#include "
lldb/Host/OptionParser.h
"
12
13
using namespace
lldb
;
14
using namespace
lldb_private
;
15
16
OptionGroupOutputFile::OptionGroupOutputFile
() : m_append(false, false) {}
17
18
static
const
uint32_t
SHORT_OPTION_APND
= 0x61706e64;
// 'apnd'
19
20
static
constexpr
OptionDefinition
g_option_table
[] = {
21
{
LLDB_OPT_SET_1
,
false
,
"outfile"
,
'o'
,
OptionParser::eRequiredArgument
,
22
nullptr
, {}, 0,
eArgTypeFilename
,
23
"Specify a path for capturing command output."
},
24
{
LLDB_OPT_SET_1
,
false
,
"append-outfile"
,
SHORT_OPTION_APND
,
25
OptionParser::eNoArgument
,
nullptr
, {}, 0,
eArgTypeNone
,
26
"Append to the file specified with '--outfile <path>'."
},
27
};
28
29
llvm::ArrayRef<OptionDefinition>
OptionGroupOutputFile::GetDefinitions
() {
30
return
llvm::ArrayRef(
g_option_table
);
31
}
32
33
Status
34
OptionGroupOutputFile::SetOptionValue
(uint32_t option_idx,
35
llvm::StringRef option_arg,
36
ExecutionContext
*execution_context) {
37
Status
error
;
38
const
int
short_option =
g_option_table
[option_idx].
short_option
;
39
40
switch
(short_option) {
41
case
'o'
:
42
error
=
m_file
.
SetValueFromString
(option_arg);
43
break
;
44
45
case
SHORT_OPTION_APND
:
46
m_append
.
SetCurrentValue
(
true
);
47
break
;
48
49
default
:
50
llvm_unreachable(
"Unimplemented option"
);
51
}
52
53
return
error
;
54
}
55
56
void
OptionGroupOutputFile::OptionParsingStarting
(
57
ExecutionContext
*execution_context) {
58
m_file
.
Clear
();
59
m_append
.
Clear
();
60
}
error
static llvm::raw_ostream & error(Stream &strm)
Definition:
CommandReturnObject.cpp:17
g_option_table
static constexpr OptionDefinition g_option_table[]
Definition:
OptionGroupArchitecture.cpp:16
SHORT_OPTION_APND
static const uint32_t SHORT_OPTION_APND
Definition:
OptionGroupOutputFile.cpp:18
OptionGroupOutputFile.h
OptionParser.h
lldb_private::ExecutionContext
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Definition:
ExecutionContext.h:292
lldb_private::OptionGroupOutputFile::OptionParsingStarting
void OptionParsingStarting(ExecutionContext *execution_context) override
Definition:
OptionGroupOutputFile.cpp:56
lldb_private::OptionGroupOutputFile::GetDefinitions
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Definition:
OptionGroupOutputFile.cpp:29
lldb_private::OptionGroupOutputFile::SetOptionValue
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
Definition:
OptionGroupOutputFile.cpp:34
lldb_private::OptionGroupOutputFile::m_append
OptionValueBoolean m_append
Definition:
OptionGroupOutputFile.h:42
lldb_private::OptionGroupOutputFile::m_file
OptionValueFileSpec m_file
Definition:
OptionGroupOutputFile.h:41
lldb_private::OptionGroupOutputFile::OptionGroupOutputFile
OptionGroupOutputFile()
Definition:
OptionGroupOutputFile.cpp:16
lldb_private::OptionParser::eNoArgument
@ eNoArgument
Definition:
OptionParser.h:35
lldb_private::OptionParser::eRequiredArgument
@ eRequiredArgument
Definition:
OptionParser.h:35
lldb_private::OptionValueBoolean::SetCurrentValue
void SetCurrentValue(bool value)
Definition:
OptionValueBoolean.h:74
lldb_private::OptionValueBoolean::Clear
void Clear() override
Definition:
OptionValueBoolean.h:40
lldb_private::OptionValueFileSpec::SetValueFromString
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
Definition:
OptionValueFileSpec.cpp:49
lldb_private::OptionValueFileSpec::Clear
void Clear() override
Definition:
OptionValueFileSpec.h:46
lldb_private::Status
An error handling class.
Definition:
Status.h:44
LLDB_OPT_SET_1
#define LLDB_OPT_SET_1
Definition:
lldb-defines.h:111
lldb_private
A class that represents a running process on the host machine.
Definition:
SBAddressRange.h:14
lldb
Definition:
SBAddress.h:15
lldb::eArgTypeFilename
@ eArgTypeFilename
Definition:
lldb-enumerations.h:580
lldb::eArgTypeNone
@ eArgTypeNone
Definition:
lldb-enumerations.h:638
lldb_private::OptionDefinition
Definition:
OptionDefinition.h:20
lldb_private::OptionDefinition::short_option
int short_option
Single character for this option.
Definition:
OptionDefinition.h:32
Generated on Wed Nov 20 2024 18:15:02 for LLDB by
1.9.6