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 
14 #include "lldb/Utility/Args.h"
15 #include "lldb/Utility/State.h"
16 
17 using namespace lldb;
18 using namespace lldb_private;
19 
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(" = ");
27 
28  if (m_current_value.IsValid()) {
29  const char *arch_name = m_current_value.GetArchitectureName();
30  if (arch_name)
31  strm.PutCString(arch_name);
32  }
33  }
34 }
35 
36 Status OptionValueArch::SetValueFromString(llvm::StringRef value,
38  Status error;
39  switch (op) {
41  Clear();
42  NotifyValueChanged();
43  break;
44 
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.SetErrorStringWithFormat("unsupported architecture '%s'",
53  value_str.c_str());
54  break;
55  }
61  error = OptionValue::SetValueFromString(value, op);
62  break;
63  }
64  return error;
65 }
66 
67 void OptionValueArch::AutoComplete(CommandInterpreter &interpreter,
68  CompletionRequest &request) {
69  CommandCompletions::InvokeCommonCompletionCallbacks(
70  interpreter, CommandCompletions::eArchitectureCompletion, request,
71  nullptr);
72 }
lldb_private::eVarSetOperationInsertBefore
@ eVarSetOperationInsertBefore
Definition: lldb-private-enumerations.h:85
lldb_private::eVarSetOperationReplace
@ eVarSetOperationReplace
Definition: lldb-private-enumerations.h:84
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
FormatManager.h
lldb_private::Stream
Definition: Stream.h:28
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::VarSetOperationType
VarSetOperationType
Settable state variable types.
Definition: lldb-private-enumerations.h:83
Args.h
lldb_private::eVarSetOperationAppend
@ eVarSetOperationAppend
Definition: lldb-private-enumerations.h:88
OptionValueArch.h
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::Status
Definition: Status.h:44
uint32_t
lldb_private::eVarSetOperationRemove
@ eVarSetOperationRemove
Definition: lldb-private-enumerations.h:87
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
CommandInterpreter.h
State.h
lldb_private::eVarSetOperationInvalid
@ eVarSetOperationInvalid
Definition: lldb-private-enumerations.h:91
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb
Definition: SBAddress.h:15
lldb_private::eVarSetOperationClear
@ eVarSetOperationClear
Definition: lldb-private-enumerations.h:89
CommandCompletions.h
DumpValue
static bool DumpValue(Stream &s, const SymbolContext *sc, const ExecutionContext *exe_ctx, const FormatEntity::Entry &entry, ValueObject *valobj)
Definition: FormatEntity.cpp:673
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::eVarSetOperationInsertAfter
@ eVarSetOperationInsertAfter
Definition: lldb-private-enumerations.h:86
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition: lldb-private-enumerations.h:90