LLDB  mainline
OptionValueFormat.cpp
Go to the documentation of this file.
1 //===-- OptionValueFormat.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 
13 #include "lldb/Utility/Stream.h"
14 
15 using namespace lldb;
16 using namespace lldb_private;
17 
19  uint32_t dump_mask) {
20  if (dump_mask & eDumpOptionType)
21  strm.Printf("(%s)", GetTypeAsCString());
22  if (dump_mask & eDumpOptionValue) {
23  if (dump_mask & eDumpOptionType)
24  strm.PutCString(" = ");
25  strm.PutCString(FormatManager::GetFormatAsCString(m_current_value));
26  }
27 }
28 
29 Status OptionValueFormat::SetValueFromString(llvm::StringRef value,
31  Status error;
32  switch (op) {
34  Clear();
35  NotifyValueChanged();
36  break;
37 
40  Format new_format;
41  error = OptionArgParser::ToFormat(value.str().c_str(), new_format, nullptr);
42  if (error.Success()) {
43  m_value_was_set = true;
44  m_current_value = new_format;
45  NotifyValueChanged();
46  }
47  } break;
48 
54  error = OptionValue::SetValueFromString(value, op);
55  break;
56  }
57  return error;
58 }
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
lldb::Format
Format
Display format definitions.
Definition: lldb-enumerations.h:155
FormatManager.h
OptionArgParser.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
OptionValueFormat.h
lldb_private::eVarSetOperationAppend
@ eVarSetOperationAppend
Definition: lldb-private-enumerations.h:88
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
lldb_private::eVarSetOperationInvalid
@ eVarSetOperationInvalid
Definition: lldb-private-enumerations.h:91
Stream.h
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
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::eVarSetOperationInsertAfter
@ eVarSetOperationInsertAfter
Definition: lldb-private-enumerations.h:86
lldb_private::eVarSetOperationAssign
@ eVarSetOperationAssign
Definition: lldb-private-enumerations.h:90