LLDB mainline
OptionValueArch.cpp
Go to the documentation of this file.
1//===-- OptionValueArch.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
15#include "lldb/Utility/Args.h"
16#include "lldb/Utility/State.h"
17
18using namespace lldb;
19using namespace lldb_private;
20
22 uint32_t dump_mask) {
23 if (dump_mask & eDumpOptionType)
24 strm.Printf("(%s)", GetTypeAsCString());
25 if (dump_mask & eDumpOptionValue) {
26 if (dump_mask & eDumpOptionType)
27 strm.PutCString(" = ");
28
29 if (m_current_value.IsValid()) {
30 const char *arch_name = m_current_value.GetArchitectureName();
31 if (arch_name)
32 strm.PutCString(arch_name);
33 }
34
35 if (dump_mask & eDumpOptionDefaultValue &&
37 DefaultValueFormat label(strm);
38 strm.PutCString(m_default_value.GetArchitectureName());
39 }
40 }
41}
42
43llvm::json::Value
45 if (m_current_value.IsValid())
46 return llvm::json::Value(m_current_value.GetArchitectureName());
47
48 return {};
49}
50
54 switch (op) {
56 Clear();
58 break;
59
62 std::string value_str = value.trim().str();
63 if (m_current_value.SetTriple(value_str.c_str())) {
64 m_value_was_set = true;
66 } else
67 error = Status::FromErrorStringWithFormat("unsupported architecture '%s'",
68 value_str.c_str());
69 break;
70 }
77 break;
78 }
79 return error;
80}
81
static llvm::raw_ostream & error(Stream &strm)
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
"lldb/Utility/ArgCompletionRequest.h"
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void AutoComplete(CommandInterpreter &interpreter, lldb_private::CompletionRequest &request) override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
virtual Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign)
virtual const char * GetTypeAsCString() const
Definition OptionValue.h:89
An error handling class.
Definition Status.h:118
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:65
A class that represents a running process on the host machine.
VarSetOperationType
Settable state variable types.
@ eArchitectureCompletion