LLDB mainline
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
10
12
13using namespace lldb;
14using namespace lldb_private;
15
17
18static const uint32_t SHORT_OPTION_APND = 0x61706e64; // 'apnd'
19
20static 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,
26 "Append to the file specified with '--outfile <path>'."},
27};
28
29llvm::ArrayRef<OptionDefinition> OptionGroupOutputFile::GetDefinitions() {
30 return llvm::ArrayRef(g_option_table);
31}
32
35 llvm::StringRef option_arg,
36 ExecutionContext *execution_context) {
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
47 break;
48
49 default:
50 llvm_unreachable("Unimplemented option");
51 }
52
53 return error;
54}
55
57 ExecutionContext *execution_context) {
58 m_file.Clear();
60}
static llvm::raw_ostream & error(Stream &strm)
static constexpr OptionDefinition g_option_table[]
static const uint32_t SHORT_OPTION_APND
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
An error handling class.
Definition: Status.h:44
#define LLDB_OPT_SET_1
Definition: lldb-defines.h:111
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Definition: SBAddress.h:15
@ eArgTypeFilename
int short_option
Single character for this option.