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() !=
'[') {
99 error.SetErrorStringWithFormat(
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)
137 error.SetErrorStringWithFormat(
138 "index %i is not valid for an empty array", idx);
140 error.SetErrorStringWithFormat(
141 "index %i out of range, valid values are 0 through %" PRIu64,
142 idx, (uint64_t)(array_count - 1));
144 error.SetErrorStringWithFormat(
"negative index %i out of range, "
145 "valid values are -1 through "
147 idx, (uint64_t)array_count);
154 const uint32_t size =
m_values.size();
155 for (uint32_t i = 0; i < size; ++i) {
156 auto string_value =
m_values[i]->GetValueAs<llvm::StringRef>();
169 error.SetErrorString(
"unsupported operation");
176 const uint32_t count =
GetSize();
178 error.SetErrorStringWithFormat(
179 "invalid insert array index %s, index must be 0 through %u",
184 for (
size_t i = 1; i < argc; ++i, ++idx) {
195 error.SetErrorString(
196 "array of complex types must subclass OptionValueArray");
202 error.SetErrorString(
"insert operation takes an array index followed by "
203 "one or more values");
209 const uint32_t size =
m_values.size();
210 std::vector<int> remove_indexes;
211 bool all_indexes_valid =
true;
213 for (i = 0; i < argc; ++i) {
216 all_indexes_valid =
false;
219 remove_indexes.push_back(idx);
222 if (all_indexes_valid) {
223 size_t num_remove_indexes = remove_indexes.size();
224 if (num_remove_indexes) {
226 if (num_remove_indexes > 1) {
227 llvm::sort(remove_indexes);
228 for (std::vector<int>::const_reverse_iterator
229 pos = remove_indexes.rbegin(),
230 end = remove_indexes.rend();
240 error.SetErrorStringWithFormat(
241 "invalid array index '%s', aborting remove operation",
245 error.SetErrorString(
"remove operation takes one or more array indices");
256 const uint32_t count =
GetSize();
258 error.SetErrorStringWithFormat(
259 "invalid replace array index %s, index must be 0 through %u",
262 for (
size_t i = 1; i < argc; ++i, ++idx) {
273 error.SetErrorString(
274 "array of complex types must subclass OptionValueArray");
280 error.SetErrorString(
"replace operation takes an array index followed by "
281 "one or more values");
290 for (
size_t i = 0; i < argc; ++i) {
299 error.SetErrorString(
300 "array of complex types must subclass OptionValueArray");
316 for (
auto &value : array_value_ptr->m_values)
317 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
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