[lldb][dwarf] Compute fully qualified names on simplified template names with DWARFT...
[llvm-project.git] / lldb / source / Interpreter / OptionValueArch.cpp
bloba2fed7737fc3ef989dfe3640d17ad40ac1d02756
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 //===----------------------------------------------------------------------===//
9 #include "lldb/Interpreter/OptionValueArch.h"
11 #include "lldb/DataFormatters/FormatManager.h"
12 #include "lldb/Interpreter/CommandCompletions.h"
13 #include "lldb/Interpreter/CommandInterpreter.h"
14 #include "lldb/Utility/Args.h"
15 #include "lldb/Utility/State.h"
17 using namespace lldb;
18 using namespace lldb_private;
20 void OptionValueArch::DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
21 uint32_t dump_mask) {
22 if (dump_mask & eDumpOptionType)
23 strm.Printf("(%s)", GetTypeAsCString());
24 if (dump_mask & eDumpOptionValue) {
25 if (dump_mask & eDumpOptionType)
26 strm.PutCString(" = ");
28 if (m_current_value.IsValid()) {
29 const char *arch_name = m_current_value.GetArchitectureName();
30 if (arch_name)
31 strm.PutCString(arch_name);
36 Status OptionValueArch::SetValueFromString(llvm::StringRef value,
37 VarSetOperationType op) {
38 Status error;
39 switch (op) {
40 case eVarSetOperationClear:
41 Clear();
42 NotifyValueChanged();
43 break;
45 case eVarSetOperationReplace:
46 case eVarSetOperationAssign: {
47 std::string value_str = value.trim().str();
48 if (m_current_value.SetTriple(value_str.c_str())) {
49 m_value_was_set = true;
50 NotifyValueChanged();
51 } else
52 error = Status::FromErrorStringWithFormat("unsupported architecture '%s'",
53 value_str.c_str());
54 break;
56 case eVarSetOperationInsertBefore:
57 case eVarSetOperationInsertAfter:
58 case eVarSetOperationRemove:
59 case eVarSetOperationAppend:
60 case eVarSetOperationInvalid:
61 error = OptionValue::SetValueFromString(value, op);
62 break;
64 return error;
67 void OptionValueArch::AutoComplete(CommandInterpreter &interpreter,
68 CompletionRequest &request) {
69 lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
70 interpreter, lldb::eArchitectureCompletion, request, nullptr);