1 //===-- OptionValueArch.cpp ---------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/lldb-python.h"
12 #include "lldb/Interpreter/OptionValueArch.h"
16 // Other libraries and framework includes
18 #include "lldb/Core/State.h"
19 #include "lldb/DataFormatters/FormatManager.h"
20 #include "lldb/Interpreter/Args.h"
21 #include "lldb/Interpreter/CommandCompletions.h"
24 using namespace lldb_private;
27 OptionValueArch::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
29 if (dump_mask & eDumpOptionType)
30 strm.Printf ("(%s)", GetTypeAsCString ());
31 if (dump_mask & eDumpOptionValue)
33 if (dump_mask & eDumpOptionType)
34 strm.PutCString (" = ");
36 if (m_current_value.IsValid())
38 const char *arch_name = m_current_value.GetArchitectureName();
40 strm.PutCString (arch_name);
46 OptionValueArch::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
51 case eVarSetOperationClear:
55 case eVarSetOperationReplace:
56 case eVarSetOperationAssign:
57 if (value_cstr && value_cstr[0])
59 if (m_current_value.SetTriple (value_cstr))
60 m_value_was_set = true;
62 error.SetErrorStringWithFormat("unsupported architecture '%s'", value_cstr);
66 error.SetErrorString("invalid value string");
70 case eVarSetOperationInsertBefore:
71 case eVarSetOperationInsertAfter:
72 case eVarSetOperationRemove:
73 case eVarSetOperationAppend:
74 case eVarSetOperationInvalid:
75 error = OptionValue::SetValueFromCString (value_cstr, op);
82 OptionValueArch::DeepCopy () const
84 return OptionValueSP(new OptionValueArch(*this));
89 OptionValueArch::AutoComplete (CommandInterpreter &interpreter,
91 int match_start_point,
92 int max_return_elements,
96 word_complete = false;
98 CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
99 CommandCompletions::eArchitectureCompletion,
106 return matches.GetSize();