29 const uint32_t size =
m_values.size();
31 strm.
Printf(
" =%s", (
m_values.size() > 0 && !one_line) ?
"\n" :
"");
34 for (uint32_t i = 0; i < size; ++i) {
40 switch (array_element_type) {
47 m_values[i]->DumpValue(exe_ctx, strm, dump_mask | extra_dump_options);
79 llvm::json::Array json_array;
80 const uint32_t size =
m_values.size();
81 for (uint32_t i = 0; i < size; ++i)
82 json_array.emplace_back(
m_values[i]->ToJSON(exe_ctx));
88 Args args(value.str());
98 if (name.empty() || name.front() !=
'[') {
100 "invalid value path '%s', %s values only support '[<index>]' subvalues "
101 "where <index> is a positive or negative array index",
106 name = name.drop_front();
107 llvm::StringRef index, sub_value;
108 std::tie(index, sub_value) = name.split(
']');
109 if (index.size() == name.size()) {
114 const size_t array_count =
m_values.size();
116 if (index.getAsInteger(0, idx))
122 new_idx = array_count - idx;
128 if (new_idx < array_count) {
130 if (!sub_value.empty())
131 return m_values[new_idx]->GetSubValue(exe_ctx, sub_value,
error);
136 if (array_count == 0)
138 "index %i is not valid for an empty array", idx);
141 "index %i out of range, valid values are 0 through %" PRIu64, idx,
142 (uint64_t)(array_count - 1));
146 "valid values are -1 through "
148 idx, (uint64_t)array_count);
155 const uint32_t size =
m_values.size();
156 for (uint32_t i = 0; i < size; ++i) {
157 auto string_value =
m_values[i]->GetValueAs<llvm::StringRef>();
177 const uint32_t count =
GetSize();
180 "invalid insert array index %s, index must be 0 through %u",
185 for (
size_t i = 1; i < argc; ++i, ++idx) {
197 "array of complex types must subclass OptionValueArray");
204 "insert operation takes an array index followed by "
205 "one or more values");
211 const uint32_t size =
m_values.size();
212 std::vector<int> remove_indexes;
213 bool all_indexes_valid =
true;
215 for (i = 0; i < argc; ++i) {
218 all_indexes_valid =
false;
221 remove_indexes.push_back(idx);
224 if (all_indexes_valid) {
225 size_t num_remove_indexes = remove_indexes.size();
226 if (num_remove_indexes) {
228 if (num_remove_indexes > 1) {
229 llvm::sort(remove_indexes);
230 for (std::vector<int>::const_reverse_iterator
231 pos = remove_indexes.rbegin(),
232 end = remove_indexes.rend();
243 "invalid array index '%s', aborting remove operation",
248 "remove operation takes one or more array indices");
259 const uint32_t count =
GetSize();
262 "invalid replace array index %s, index must be 0 through %u",
265 for (
size_t i = 1; i < argc; ++i, ++idx) {
277 "array of complex types must subclass OptionValueArray");
284 "replace operation takes an array index followed by "
285 "one or more values");
294 for (
size_t i = 0; i < argc; ++i) {
304 "array of complex types must subclass OptionValueArray");
320 for (
auto &value : array_value_ptr->m_values)
321 value = value->DeepCopy(copy_sp);
static llvm::raw_ostream & error(Stream &strm)
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
void Clear()
Clear the arguments.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool AppendValue(const lldb::OptionValueSP &value_sp)
Status SetArgs(const Args &args, VarSetOperationType op)
OptionValue::Type GetType() const override
lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, Status &error) const override
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
lldb::OptionValueSP DeepCopy(const lldb::OptionValueSP &new_parent) const override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override
size_t GetArgs(Args &args) const
static lldb::OptionValueSP CreateValueFromCStringForTypeMask(const char *value_cstr, uint32_t type_mask, Status &error)
static OptionValue::Type ConvertTypeMaskToType(uint32_t type_mask)
virtual lldb::OptionValueSP DeepCopy(const lldb::OptionValueSP &new_parent) const
static const char * GetBuiltinTypeAsCString(Type t)
void NotifyValueChanged()
virtual const char * GetTypeAsCString() const
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
A stream class that can stream formatted output to a file.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t EOL()
Output and End of Line character to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
A class that represents a running process on the host machine.
VarSetOperationType
Settable state variable types.
@ eVarSetOperationReplace
@ eVarSetOperationInvalid
@ eVarSetOperationInsertBefore
@ eVarSetOperationInsertAfter
std::shared_ptr< lldb_private::OptionValue > OptionValueSP