aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp5
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp184
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.cpp11
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp26
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp14
-rw-r--r--lldb/source/Commands/CommandObjectLog.cpp10
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp16
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp44
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp6
-rw-r--r--lldb/source/Commands/CommandObjectScripting.cpp6
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp25
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp41
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp46
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp58
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp4
-rw-r--r--lldb/source/Commands/CommandObjectWatchpointCommand.cpp5
-rw-r--r--lldb/source/Commands/CommandOptionsProcessAttach.cpp4
-rw-r--r--lldb/source/Commands/CommandOptionsProcessLaunch.cpp9
18 files changed, 277 insertions, 237 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 23ea422..b668cd0 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -278,9 +278,8 @@ are no syntax errors may indicate that a function was declared but never called.
m_stop_on_error =
OptionArgParser::ToBoolean(option_arg, false, &success);
if (!success)
- error.SetErrorStringWithFormat(
- "invalid value for stop-on-error: \"%s\"",
- option_arg.str().c_str());
+ return Status::FromErrorStringWithFormatv(
+ "invalid value for stop-on-error: \"{0}\"", option_arg);
} break;
case 'D':
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 7c439f4..f8f2b97 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -878,7 +878,7 @@ protected:
Status error;
if (!m_regex_cmd_up) {
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"invalid regular expression command object for: '%.*s'",
(int)regex_sed.size(), regex_sed.data());
return error;
@@ -887,16 +887,17 @@ protected:
size_t regex_sed_size = regex_sed.size();
if (regex_sed_size <= 1) {
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"regular expression substitution string is too short: '%.*s'",
(int)regex_sed.size(), regex_sed.data());
return error;
}
if (regex_sed[0] != 's') {
- error.SetErrorStringWithFormat("regular expression substitution string "
- "doesn't start with 's': '%.*s'",
- (int)regex_sed.size(), regex_sed.data());
+ return Status::FromErrorStringWithFormat(
+ "regular expression substitution string "
+ "doesn't start with 's': '%.*s'",
+ (int)regex_sed.size(), regex_sed.data());
return error;
}
const size_t first_separator_char_pos = 1;
@@ -907,7 +908,7 @@ protected:
regex_sed.find(separator_char, first_separator_char_pos + 1);
if (second_separator_char_pos == std::string::npos) {
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"missing second '%c' separator char after '%.*s' in '%.*s'",
separator_char,
(int)(regex_sed.size() - first_separator_char_pos - 1),
@@ -920,7 +921,7 @@ protected:
regex_sed.find(separator_char, second_separator_char_pos + 1);
if (third_separator_char_pos == std::string::npos) {
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"missing third '%c' separator char after '%.*s' in '%.*s'",
separator_char,
(int)(regex_sed.size() - second_separator_char_pos - 1),
@@ -934,7 +935,7 @@ protected:
if (regex_sed.find_first_not_of("\t\n\v\f\r ",
third_separator_char_pos + 1) !=
std::string::npos) {
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"extra data found after the '%.*s' regular expression substitution "
"string: '%.*s'",
(int)third_separator_char_pos + 1, regex_sed.data(),
@@ -943,13 +944,13 @@ protected:
return error;
}
} else if (first_separator_char_pos + 1 == second_separator_char_pos) {
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"<regex> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",
separator_char, separator_char, separator_char, (int)regex_sed.size(),
regex_sed.data());
return error;
} else if (second_separator_char_pos + 1 == third_separator_char_pos) {
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"<subst> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",
separator_char, separator_char, separator_char, (int)regex_sed.size(),
regex_sed.data());
@@ -1249,16 +1250,19 @@ private:
ScriptInterpreter *scripter =
m_interpreter.GetDebugger().GetScriptInterpreter();
if (!scripter) {
- error.SetErrorString("No script interpreter for SetOptionValue.");
+ return Status::FromErrorString(
+ "No script interpreter for SetOptionValue.");
return error;
}
if (!m_cmd_obj_sp) {
- error.SetErrorString("SetOptionValue called with empty cmd_obj.");
+ return Status::FromErrorString(
+ "SetOptionValue called with empty cmd_obj.");
return error;
}
if (!m_options_definition_up) {
- error.SetErrorString("SetOptionValue called before options definitions "
- "were created.");
+ return Status::FromErrorString(
+ "SetOptionValue called before options definitions "
+ "were created.");
return error;
}
// Pass the long option, since you aren't actually required to have a
@@ -1269,8 +1273,8 @@ private:
bool success = scripter->SetOptionValueForCommandObject(m_cmd_obj_sp,
execution_context, long_option, option_arg);
if (!success)
- error.SetErrorStringWithFormatv("Error setting option: {0} to {1}",
- long_option, option_arg);
+ return Status::FromErrorStringWithFormatv(
+ "Error setting option: {0} to {1}", long_option, option_arg);
return error;
}
@@ -1311,9 +1315,8 @@ private:
// If this is an integer, then this specifies a single group:
uint32_t value = uint_val->GetValue();
if (value == 0) {
- error.SetErrorStringWithFormatv(
+ return Status::FromErrorStringWithFormatv(
"0 is not a valid group for option {0}", counter);
- return error;
}
usage_mask = (1 << (value - 1));
return error;
@@ -1321,9 +1324,8 @@ private:
// Otherwise it has to be an array:
StructuredData::Array *array_val = obj_sp->GetAsArray();
if (!array_val) {
- error.SetErrorStringWithFormatv(
+ return Status::FromErrorStringWithFormatv(
"required field is not a array for option {0}", counter);
- return error;
}
// This is the array ForEach for accumulating a group usage mask from
// an array of string descriptions of groups.
@@ -1334,7 +1336,7 @@ private:
if (int_val) {
uint32_t value = int_val->GetValue();
if (value == 0) {
- error.SetErrorStringWithFormatv(
+ error = Status::FromErrorStringWithFormatv(
"0 is not a valid group for element {0}", counter);
return false;
}
@@ -1343,35 +1345,41 @@ private:
}
StructuredData::Array *arr_val = obj->GetAsArray();
if (!arr_val) {
- error.SetErrorStringWithFormatv(
- "Group element not an int or array of integers for element {0}",
+ error = Status::FromErrorStringWithFormatv(
+ "Group element not an int or array of integers for element {0}",
counter);
return false;
}
size_t num_range_elem = arr_val->GetSize();
if (num_range_elem != 2) {
- error.SetErrorStringWithFormatv(
- "Subranges of a group not a start and a stop for element {0}",
+ error = Status::FromErrorStringWithFormatv(
+ "Subranges of a group not a start and a stop for element {0}",
counter);
return false;
}
int_val = arr_val->GetItemAtIndex(0)->GetAsUnsignedInteger();
if (!int_val) {
- error.SetErrorStringWithFormatv("Start element of a subrange of a "
- "group not unsigned int for element {0}", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "Start element of a subrange of a "
+ "group not unsigned int for element {0}",
+ counter);
return false;
}
uint32_t start = int_val->GetValue();
int_val = arr_val->GetItemAtIndex(1)->GetAsUnsignedInteger();
if (!int_val) {
- error.SetErrorStringWithFormatv("End element of a subrange of a group"
- " not unsigned int for element {0}", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "End element of a subrange of a group"
+ " not unsigned int for element {0}",
+ counter);
return false;
}
uint32_t end = int_val->GetValue();
if (start == 0 || end == 0 || start > end) {
- error.SetErrorStringWithFormatv("Invalid subrange of a group: {0} - "
- "{1} for element {2}", start, end, counter);
+ error = Status::FromErrorStringWithFormatv(
+ "Invalid subrange of a group: {0} - "
+ "{1} for element {2}",
+ start, end, counter);
return false;
}
for (uint32_t i = start; i <= end; i++) {
@@ -1401,7 +1409,8 @@ private:
(llvm::StringRef long_option, StructuredData::Object *object) -> bool {
StructuredData::Dictionary *opt_dict = object->GetAsDictionary();
if (!opt_dict) {
- error.SetErrorString("Value in options dictionary is not a dictionary");
+ error = Status::FromErrorString(
+ "Value in options dictionary is not a dictionary");
return false;
}
OptionDefinition &option_def = m_options_definition_up.get()[counter];
@@ -1432,8 +1441,10 @@ private:
if (obj_sp) {
StructuredData::Boolean *boolean_val = obj_sp->GetAsBoolean();
if (!boolean_val) {
- error.SetErrorStringWithFormatv("'required' field is not a boolean "
- "for option {0}", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "'required' field is not a boolean "
+ "for option {0}",
+ counter);
return false;
}
option_def.required = boolean_val->GetValue();
@@ -1446,12 +1457,16 @@ private:
// The value is a string, so pull the
llvm::StringRef short_str = obj_sp->GetStringValue();
if (short_str.empty()) {
- error.SetErrorStringWithFormatv("short_option field empty for "
- "option {0}", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "short_option field empty for "
+ "option {0}",
+ counter);
return false;
} else if (short_str.size() != 1) {
- error.SetErrorStringWithFormatv("short_option field has extra "
- "characters for option {0}", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "short_option field has extra "
+ "characters for option {0}",
+ counter);
return false;
}
short_option = (int) short_str[0];
@@ -1464,8 +1479,8 @@ private:
// Long Option is the key from the outer dict:
if (long_option.empty()) {
- error.SetErrorStringWithFormatv("empty long_option for option {0}",
- counter);
+ error = Status::FromErrorStringWithFormatv(
+ "empty long_option for option {0}", counter);
return false;
}
auto inserted = g_string_storer.insert(long_option.str());
@@ -1477,14 +1492,17 @@ private:
StructuredData::UnsignedInteger *uint_val
= obj_sp->GetAsUnsignedInteger();
if (!uint_val) {
- error.SetErrorStringWithFormatv("Value type must be an unsigned "
+ error = Status::FromErrorStringWithFormatv(
+ "Value type must be an unsigned "
"integer");
return false;
}
uint64_t val_type = uint_val->GetValue();
if (val_type >= eArgTypeLastArg) {
- error.SetErrorStringWithFormatv("Value type {0} beyond the "
- "CommandArgumentType bounds", val_type);
+ error =
+ Status::FromErrorStringWithFormatv("Value type {0} beyond the "
+ "CommandArgumentType bounds",
+ val_type);
return false;
}
option_def.argument_type = (CommandArgumentType) val_type;
@@ -1499,14 +1517,18 @@ private:
if (obj_sp) {
StructuredData::UnsignedInteger *uint_val = obj_sp->GetAsUnsignedInteger();
if (!uint_val) {
- error.SetErrorStringWithFormatv("Completion type must be an "
- "unsigned integer for option {0}", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "Completion type must be an "
+ "unsigned integer for option {0}",
+ counter);
return false;
}
uint64_t completion_type = uint_val->GetValue();
if (completion_type > eCustomCompletion) {
- error.SetErrorStringWithFormatv("Completion type for option {0} "
- "beyond the CompletionType bounds", completion_type);
+ error = Status::FromErrorStringWithFormatv(
+ "Completion type for option {0} "
+ "beyond the CompletionType bounds",
+ completion_type);
return false;
}
option_def.completion_type = (CommandArgumentType) completion_type;
@@ -1517,15 +1539,17 @@ private:
std::string usage_text;
obj_sp = opt_dict->GetValueForKey("help");
if (!obj_sp) {
- error.SetErrorStringWithFormatv("required usage missing from option "
- "{0}", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "required usage missing from option "
+ "{0}",
+ counter);
return false;
}
llvm::StringRef usage_stref;
usage_stref = obj_sp->GetStringValue();
if (usage_stref.empty()) {
- error.SetErrorStringWithFormatv("empty usage text for option {0}",
- counter);
+ error = Status::FromErrorStringWithFormatv(
+ "empty usage text for option {0}", counter);
return false;
}
m_usage_container[counter] = usage_stref.str().c_str();
@@ -1537,8 +1561,10 @@ private:
if (obj_sp) {
StructuredData::Array *array = obj_sp->GetAsArray();
if (!array) {
- error.SetErrorStringWithFormatv("enum values must be an array for "
- "option {0}", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "enum values must be an array for "
+ "option {0}",
+ counter);
return false;
}
size_t num_elem = array->GetSize();
@@ -1554,13 +1580,16 @@ private:
(StructuredData::Object *object) -> bool {
StructuredData::Array *enum_arr = object->GetAsArray();
if (!enum_arr) {
- error.SetErrorStringWithFormatv("Enum values for option {0} not "
- "an array", counter);
+ error = Status::FromErrorStringWithFormatv(
+ "Enum values for option {0} not "
+ "an array",
+ counter);
return false;
}
size_t num_enum_elements = enum_arr->GetSize();
if (num_enum_elements != 2) {
- error.SetErrorStringWithFormatv("Wrong number of elements: {0} "
+ error = Status::FromErrorStringWithFormatv(
+ "Wrong number of elements: {0} "
"for enum {1} in option {2}",
num_enum_elements, enum_ctr, counter);
return false;
@@ -1573,8 +1602,10 @@ private:
// Enum Usage:
obj_sp = enum_arr->GetItemAtIndex(1);
if (!obj_sp) {
- error.SetErrorStringWithFormatv("No usage for enum {0} in option "
- "{1}", enum_ctr, counter);
+ error = Status::FromErrorStringWithFormatv(
+ "No usage for enum {0} in option "
+ "{1}",
+ enum_ctr, counter);
return false;
}
llvm::StringRef usage_stref = obj_sp->GetStringValue();
@@ -1701,7 +1732,7 @@ public:
StreamString stream;
ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter();
if (!scripter) {
- m_options_error.SetErrorString("No script interpreter");
+ m_options_error = Status::FromErrorString("No script interpreter");
return;
}
@@ -1725,7 +1756,7 @@ public:
if (m_options_error.Fail())
return;
} else {
- m_options_error.SetErrorString("Options array not an array");
+ m_options_error = Status::FromErrorString("Options array not an array");
return;
}
}
@@ -1736,7 +1767,8 @@ public:
if (args_object_sp) {
StructuredData::Array *args_array = args_object_sp->GetAsArray();
if (!args_array) {
- m_args_error.SetErrorString("Argument specification is not an array");
+ m_args_error =
+ Status::FromErrorString("Argument specification is not an array");
return;
}
size_t counter = 0;
@@ -1755,14 +1787,16 @@ public:
CommandArgumentType arg_type = eArgTypeNone;
ArgumentRepetitionType arg_repetition = eArgRepeatOptional;
uint32_t arg_opt_set_association;
-
- auto report_error = [this, elem_counter, counter]
- (const char *err_txt) -> bool {
- m_args_error.SetErrorStringWithFormatv("Element {0} of arguments "
- "list element {1}: %s.", elem_counter, counter, err_txt);
+
+ auto report_error = [this, elem_counter,
+ counter](const char *err_txt) -> bool {
+ m_args_error = Status::FromErrorStringWithFormatv(
+ "Element {0} of arguments "
+ "list element {1}: %s.",
+ elem_counter, counter, err_txt);
return false;
};
-
+
StructuredData::Dictionary *arg_dict = object->GetAsDictionary();
if (!arg_dict) {
report_error("is not a dictionary.");
@@ -1813,16 +1847,20 @@ public:
};
StructuredData::Array *args_array = object->GetAsArray();
if (!args_array) {
- m_args_error.SetErrorStringWithFormatv("Argument definition element "
- "{0} is not an array", counter);
+ m_args_error =
+ Status::FromErrorStringWithFormatv("Argument definition element "
+ "{0} is not an array",
+ counter);
}
args_array->ForEach(args_adder);
if (m_args_error.Fail())
return false;
if (this_entry.empty()) {
- m_args_error.SetErrorStringWithFormatv("Argument definition element "
- "{0} is empty", counter);
+ m_args_error =
+ Status::FromErrorStringWithFormatv("Argument definition element "
+ "{0} is empty",
+ counter);
return false;
}
m_arguments.push_back(this_entry);
@@ -2098,7 +2136,7 @@ protected:
(ScriptedCommandSynchronicity)OptionArgParser::ToOptionEnum(
option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
if (!error.Success())
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"unrecognized value for synchronicity '%s'",
option_arg.str().c_str());
break;
@@ -2109,7 +2147,7 @@ protected:
static_cast<lldb::CompletionType>(OptionArgParser::ToOptionEnum(
option_arg, definition.enum_values, eNoCompletion, error));
if (!error.Success())
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"unrecognized value for command completion type '%s'",
option_arg.str().c_str());
m_completion_type = completion_type;
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 652a300..250f849 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -51,13 +51,13 @@ Status CommandObjectDisassemble::CommandOptions::SetOptionValue(
case 'C':
if (option_arg.getAsInteger(0, num_lines_context))
- error.SetErrorStringWithFormat("invalid num context lines string: \"%s\"",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid num context lines string: \"%s\"", option_arg.str().c_str());
break;
case 'c':
if (option_arg.getAsInteger(0, num_instructions))
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid num of instructions string: \"%s\"",
option_arg.str().c_str());
break;
@@ -114,8 +114,9 @@ Status CommandObjectDisassemble::CommandOptions::SetOptionValue(
llvm::Triple::x86_64)) {
flavor_string.assign(std::string(option_arg));
} else
- error.SetErrorStringWithFormat("Disassembler flavors are currently only "
- "supported for x86 and x86_64 targets.");
+ error = Status::FromErrorStringWithFormat(
+ "Disassembler flavors are currently only "
+ "supported for x86 and x86_64 targets.");
break;
}
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index 769f01d..7711946 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -52,7 +52,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
option_arg.str().c_str());
Language::PrintSupportedLanguagesForExpressions(sstr, " ", "\n");
- error.SetErrorString(sstr.GetString());
+ error = Status(sstr.GetString().str());
}
break;
@@ -61,7 +61,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
bool result;
result = OptionArgParser::ToBoolean(option_arg, true, &success);
if (!success)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid all-threads value setting: \"%s\"",
option_arg.str().c_str());
else
@@ -74,7 +74,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
if (success)
ignore_breakpoints = tmp_value;
else
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"could not convert \"%s\" to a boolean value.",
option_arg.str().c_str());
break;
@@ -86,7 +86,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
if (success)
allow_jit = tmp_value;
else
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"could not convert \"%s\" to a boolean value.",
option_arg.str().c_str());
break;
@@ -95,8 +95,8 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
case 't':
if (option_arg.getAsInteger(0, timeout)) {
timeout = 0;
- error.SetErrorStringWithFormat("invalid timeout setting \"%s\"",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid timeout setting \"%s\"", option_arg.str().c_str());
}
break;
@@ -106,7 +106,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
if (success)
unwind_on_error = tmp_value;
else
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"could not convert \"%s\" to a boolean value.",
option_arg.str().c_str());
break;
@@ -121,7 +121,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
OptionArgParser::ToOptionEnum(
option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
if (!error.Success())
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"unrecognized value for description-verbosity '%s'",
option_arg.str().c_str());
break;
@@ -142,7 +142,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
if (success)
auto_apply_fixits = tmp_value ? eLazyBoolYes : eLazyBoolNo;
else
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"could not convert \"%s\" to a boolean value.",
option_arg.str().c_str());
break;
@@ -155,7 +155,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue(
if (success)
suppress_persistent_result = !persist_result ? eLazyBoolYes : eLazyBoolNo;
else
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"could not convert \"%s\" to a boolean value.",
option_arg.str().c_str());
break;
@@ -392,9 +392,9 @@ CanBeUsedForElementCountPrinting(ValueObject &valobj) {
CompilerType type(valobj.GetCompilerType());
CompilerType pointee;
if (!type.IsPointerType(&pointee))
- return Status("as it does not refer to a pointer");
+ return Status::FromErrorString("as it does not refer to a pointer");
if (pointee.IsVoidType())
- return Status("as it refers to a pointer to void");
+ return Status::FromErrorString("as it refers to a pointer to void");
return Status();
}
@@ -650,7 +650,7 @@ void CommandObjectExpression::DoExecute(llvm::StringRef command,
io_handler_sp->SetIsDone(false);
debugger.RunIOHandlerAsync(io_handler_sp);
} else {
- repl_error.SetErrorStringWithFormat(
+ repl_error = Status::FromErrorStringWithFormat(
"Couldn't create a REPL for %s",
Language::GetNameForLanguageType(m_command_options.language));
result.SetError(repl_error);
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index ef57582..d8091e8 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -68,8 +68,8 @@ public:
address.emplace();
if (option_arg.getAsInteger(0, *address)) {
address.reset();
- error.SetErrorStringWithFormat("invalid address argument '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid address argument '%s'", option_arg.str().c_str());
}
} break;
@@ -77,8 +77,8 @@ public:
offset.emplace();
if (option_arg.getAsInteger(0, *offset)) {
offset.reset();
- error.SetErrorStringWithFormat("invalid offset argument '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid offset argument '%s'", option_arg.str().c_str());
}
} break;
@@ -223,8 +223,8 @@ public:
case 'r': {
int32_t offset = 0;
if (option_arg.getAsInteger(0, offset) || offset == INT32_MIN) {
- error.SetErrorStringWithFormat("invalid frame offset argument '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid frame offset argument '%s'", option_arg.str().c_str());
} else
relative_frame_offset = offset;
break;
@@ -747,7 +747,7 @@ private:
if (success) {
m_first_instruction_only = value;
} else {
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid boolean value '%s' passed for -f option",
option_arg.str().c_str());
}
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp
index 48dfd94..9eb68dd 100644
--- a/lldb/source/Commands/CommandObjectLog.cpp
+++ b/lldb/source/Commands/CommandObjectLog.cpp
@@ -99,14 +99,12 @@ public:
handler = (LogHandlerKind)OptionArgParser::ToOptionEnum(
option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
if (!error.Success())
- error.SetErrorStringWithFormat(
- "unrecognized value for log handler '%s'",
- option_arg.str().c_str());
+ return Status::FromErrorStringWithFormatv(
+ "unrecognized value for log handler '{0}'", option_arg);
break;
case 'b':
- error =
- buffer_size.SetValueFromString(option_arg, eVarSetOperationAssign);
- break;
+ return buffer_size.SetValueFromString(option_arg,
+ eVarSetOperationAssign);
case 'v':
log_options |= LLDB_LOG_OPTION_VERBOSE;
break;
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index baf5d91..f93081d3 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -68,7 +68,7 @@ public:
case 'l':
error = m_num_per_line.SetValueFromString(option_value);
if (m_num_per_line.GetCurrentValue() == 0)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid value for --num-per-line option '%s'",
option_value.str().c_str());
break;
@@ -176,7 +176,7 @@ public:
case eFormatBytesWithASCII:
if (byte_size_option_set) {
if (byte_size_value > 1)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"display format (bytes/bytes with ASCII) conflicts with the "
"specified byte size %" PRIu64 "\n"
"\tconsider using a different display format or don't specify "
@@ -913,12 +913,12 @@ public:
case 'c':
if (m_count.SetValueFromString(option_value).Fail())
- error.SetErrorString("unrecognized value for count");
+ error = Status::FromErrorString("unrecognized value for count");
break;
case 'o':
if (m_offset.SetValueFromString(option_value).Fail())
- error.SetErrorString("unrecognized value for dump-offset");
+ error = Status::FromErrorString("unrecognized value for dump-offset");
break;
default:
@@ -1150,16 +1150,16 @@ public:
FileSystem::Instance().Resolve(m_infile);
if (!FileSystem::Instance().Exists(m_infile)) {
m_infile.Clear();
- error.SetErrorStringWithFormat("input file does not exist: '%s'",
- option_value.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "input file does not exist: '%s'", option_value.str().c_str());
}
break;
case 'o': {
if (option_value.getAsInteger(0, m_infile_offset)) {
m_infile_offset = 0;
- error.SetErrorStringWithFormat("invalid offset string '%s'",
- option_value.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid offset string '%s'", option_value.str().c_str());
}
} break;
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index 5b18f2b..f849a38 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -78,16 +78,16 @@ public:
case 'v': {
if (option_arg.getAsInteger(8, m_permissions)) {
m_permissions = 0777;
- error.SetErrorStringWithFormat("invalid value for permissions: %s",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid value for permissions: %s", option_arg.str().c_str());
}
} break;
case 's': {
mode_t perms = ParsePermissionString(option_arg);
if (perms == (mode_t)-1)
- error.SetErrorStringWithFormat("invalid value for permissions: %s",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid value for permissions: %s", option_arg.str().c_str());
else
m_permissions = perms;
} break;
@@ -609,13 +609,13 @@ protected:
switch (short_option) {
case 'o':
if (option_arg.getAsInteger(0, m_offset))
- error.SetErrorStringWithFormat("invalid offset: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid offset: '%s'",
+ option_arg.str().c_str());
break;
case 'c':
if (option_arg.getAsInteger(0, m_count))
- error.SetErrorStringWithFormat("invalid offset: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid offset: '%s'",
+ option_arg.str().c_str());
break;
default:
llvm_unreachable("Unimplemented option");
@@ -702,8 +702,8 @@ protected:
switch (short_option) {
case 'o':
if (option_arg.getAsInteger(0, m_offset))
- error.SetErrorStringWithFormat("invalid offset: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid offset: '%s'",
+ option_arg.str().c_str());
break;
case 'd':
m_data.assign(std::string(option_arg));
@@ -1328,14 +1328,14 @@ protected:
case 'p': {
match_info.GetProcessInfo().SetProcessID(id);
if (!success)
- error.SetErrorStringWithFormat("invalid process ID string: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid process ID string: '%s'", option_arg.str().c_str());
break;
}
case 'P':
match_info.GetProcessInfo().SetParentProcessID(id);
if (!success)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid parent process ID string: '%s'",
option_arg.str().c_str());
break;
@@ -1343,15 +1343,15 @@ protected:
case 'u':
match_info.GetProcessInfo().SetUserID(success ? id : UINT32_MAX);
if (!success)
- error.SetErrorStringWithFormat("invalid user ID string: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid user ID string: '%s'", option_arg.str().c_str());
break;
case 'U':
match_info.GetProcessInfo().SetEffectiveUserID(success ? id
: UINT32_MAX);
if (!success)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid effective user ID string: '%s'",
option_arg.str().c_str());
break;
@@ -1359,15 +1359,15 @@ protected:
case 'g':
match_info.GetProcessInfo().SetGroupID(success ? id : UINT32_MAX);
if (!success)
- error.SetErrorStringWithFormat("invalid group ID string: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid group ID string: '%s'", option_arg.str().c_str());
break;
case 'G':
match_info.GetProcessInfo().SetEffectiveGroupID(success ? id
: UINT32_MAX);
if (!success)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid effective group ID string: '%s'",
option_arg.str().c_str());
break;
@@ -1630,7 +1630,7 @@ public:
case 't':
uint32_t timeout_sec;
if (option_arg.getAsInteger(10, timeout_sec))
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"could not convert \"%s\" to a numeric value.",
option_arg.str().c_str());
else
@@ -1638,7 +1638,7 @@ public:
break;
case 's': {
if (option_arg.empty()) {
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"missing shell interpreter path for option -i|--interpreter.");
return error;
}
@@ -1734,7 +1734,7 @@ public:
} else {
result.GetOutputStream().Printf(
"error: cannot run remote shell commands without a platform\n");
- error.SetErrorString(
+ error = Status::FromErrorString(
"error: cannot run remote shell commands without a platform");
}
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 1a5ce7de..5b0f4f6 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -453,7 +453,7 @@ protected:
switch (short_option) {
case 'i':
if (option_arg.getAsInteger(0, m_ignore))
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid value for ignore option: \"%s\", should be a number.",
option_arg.str().c_str());
break;
@@ -744,8 +744,8 @@ public:
bool success;
tmp_result = OptionArgParser::ToBoolean(option_arg, false, &success);
if (!success)
- error.SetErrorStringWithFormat("invalid boolean option: \"%s\"",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid boolean option: \"%s\"", option_arg.str().c_str());
else {
if (tmp_result)
m_keep_stopped = eLazyBoolYes;
diff --git a/lldb/source/Commands/CommandObjectScripting.cpp b/lldb/source/Commands/CommandObjectScripting.cpp
index 698e297..9a1a2b6 100644
--- a/lldb/source/Commands/CommandObjectScripting.cpp
+++ b/lldb/source/Commands/CommandObjectScripting.cpp
@@ -56,8 +56,8 @@ public:
option_arg, GetDefinitions()[option_idx].enum_values,
eScriptLanguageNone, error);
if (!error.Success())
- error.SetErrorStringWithFormat("unrecognized value for language '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "unrecognized value for language '%s'", option_arg.str().c_str());
break;
default:
llvm_unreachable("Unimplemented option");
@@ -159,7 +159,7 @@ public:
option_arg, GetDefinitions()[option_idx].enum_values,
eScriptLanguageNone, error);
if (!error.Success())
- error.SetErrorStringWithFormatv(
+ error = Status::FromErrorStringWithFormatv(
"unrecognized value for language '{0}'", option_arg);
break;
default:
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index 98907c4..5ddd46a 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -50,20 +50,20 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
switch (short_option) {
case 'l':
if (option_arg.getAsInteger(0, start_line))
- error.SetErrorStringWithFormat("invalid line number: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid line number: '%s'",
+ option_arg.str().c_str());
break;
case 'e':
if (option_arg.getAsInteger(0, end_line))
- error.SetErrorStringWithFormat("invalid line number: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid line number: '%s'",
+ option_arg.str().c_str());
break;
case 'c':
if (option_arg.getAsInteger(0, num_lines))
- error.SetErrorStringWithFormat("invalid line count: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid line count: '%s'",
+ option_arg.str().c_str());
break;
case 'f':
@@ -612,14 +612,14 @@ class CommandObjectSourceList : public CommandObjectParsed {
switch (short_option) {
case 'l':
if (option_arg.getAsInteger(0, start_line))
- error.SetErrorStringWithFormat("invalid line number: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid line number: '%s'",
+ option_arg.str().c_str());
break;
case 'c':
if (option_arg.getAsInteger(0, num_lines))
- error.SetErrorStringWithFormat("invalid line count: '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid line count: '%s'",
+ option_arg.str().c_str());
break;
case 'f':
@@ -649,9 +649,8 @@ class CommandObjectSourceList : public CommandObjectParsed {
OptionValueFileColonLine value;
Status fcl_err = value.SetValueFromString(option_arg);
if (!fcl_err.Success()) {
- error.SetErrorStringWithFormat(
- "Invalid value for file:line specifier: %s",
- fcl_err.AsCString());
+ error = Status::FromErrorStringWithFormat(
+ "Invalid value for file:line specifier: %s", fcl_err.AsCString());
} else {
file_name = value.GetFileSpec().GetPath();
start_line = value.GetLineNumber();
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index b77bd8b..10e761f 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -186,8 +186,8 @@ public:
if (error.Success())
m_load_dependent_files = tmp_load_dependents;
} else {
- error.SetErrorStringWithFormat("unrecognized short option '%c'",
- short_option);
+ error = Status::FromErrorStringWithFormat(
+ "unrecognized short option '%c'", short_option);
}
return error;
@@ -3461,8 +3461,8 @@ public:
m_addr = OptionArgParser::ToAddress(execution_context, option_arg,
LLDB_INVALID_ADDRESS, &error);
if (m_addr == LLDB_INVALID_ADDRESS)
- error.SetErrorStringWithFormat("invalid address string '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid address string '%s'", option_arg.str().c_str());
break;
}
@@ -3805,8 +3805,8 @@ public:
case 'o':
if (option_arg.getAsInteger(0, m_offset))
- error.SetErrorStringWithFormat("invalid offset string '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid offset string '%s'", option_arg.str().c_str());
break;
case 's':
@@ -3825,10 +3825,10 @@ public:
case 'l':
if (option_arg.getAsInteger(0, m_line_number))
- error.SetErrorStringWithFormat("invalid line number string '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid line number string '%s'", option_arg.str().c_str());
else if (m_line_number == 0)
- error.SetErrorString("zero is an invalid line number");
+ error = Status::FromErrorString("zero is an invalid line number");
m_type = eLookupTypeFileLine;
break;
@@ -3886,8 +3886,9 @@ public:
Status OptionParsingFinished(ExecutionContext *execution_context) override {
Status status;
if (m_all_ranges && !m_verbose) {
- status.SetErrorString("--show-variable-ranges must be used in "
- "conjunction with --verbose.");
+ status =
+ Status::FromErrorString("--show-variable-ranges must be used in "
+ "conjunction with --verbose.");
}
return status;
}
@@ -4709,8 +4710,8 @@ public:
case 'e':
if (option_arg.getAsInteger(0, m_line_end)) {
- error.SetErrorStringWithFormat("invalid end line number: \"%s\"",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid end line number: \"%s\"", option_arg.str().c_str());
break;
}
m_sym_ctx_specified = true;
@@ -4722,14 +4723,14 @@ public:
if (success) {
m_auto_continue = value;
} else
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid boolean value '%s' passed for -G option",
option_arg.str().c_str());
} break;
case 'l':
if (option_arg.getAsInteger(0, m_line_start)) {
- error.SetErrorStringWithFormat("invalid start line number: \"%s\"",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid start line number: \"%s\"", option_arg.str().c_str());
break;
}
m_sym_ctx_specified = true;
@@ -4757,8 +4758,8 @@ public:
case 't':
if (option_arg.getAsInteger(0, m_thread_id))
- error.SetErrorStringWithFormat("invalid thread id string '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid thread id string '%s'", option_arg.str().c_str());
m_thread_specified = true;
break;
@@ -4774,8 +4775,8 @@ public:
case 'x':
if (option_arg.getAsInteger(0, m_thread_index))
- error.SetErrorStringWithFormat("invalid thread index string '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid thread index string '%s'", option_arg.str().c_str());
m_thread_specified = true;
break;
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 6a89c16..edbec0e 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -66,7 +66,7 @@ public:
case 'c':
if (option_arg.getAsInteger(0, m_count)) {
m_count = UINT32_MAX;
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid integer value for option '%c': %s", short_option,
option_arg.data());
}
@@ -76,7 +76,7 @@ public:
break;
case 's':
if (option_arg.getAsInteger(0, m_start))
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid integer value for option '%c': %s", short_option,
option_arg.data());
break;
@@ -85,7 +85,7 @@ public:
m_extended_backtrace =
OptionArgParser::ToBoolean(option_arg, false, &success);
if (!success)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid boolean value for option '%c': %s", short_option,
option_arg.data());
} break;
@@ -286,7 +286,7 @@ public:
bool avoid_no_debug =
OptionArgParser::ToBoolean(option_arg, true, &success);
if (!success)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid boolean value for option '%c': %s", short_option,
option_arg.data());
else {
@@ -299,7 +299,7 @@ public:
bool avoid_no_debug =
OptionArgParser::ToBoolean(option_arg, true, &success);
if (!success)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid boolean value for option '%c': %s", short_option,
option_arg.data());
else {
@@ -309,7 +309,7 @@ public:
case 'c':
if (option_arg.getAsInteger(0, m_step_count))
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid integer value for option '%c': %s", short_option,
option_arg.data());
break;
@@ -326,8 +326,8 @@ public:
break;
}
if (option_arg.getAsInteger(0, m_end_line))
- error.SetErrorStringWithFormat("invalid end line number '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid end line number '%s'", option_arg.str().c_str());
break;
case 'r':
@@ -817,15 +817,15 @@ public:
case 't':
if (option_arg.getAsInteger(0, m_thread_idx)) {
m_thread_idx = LLDB_INVALID_INDEX32;
- error.SetErrorStringWithFormat("invalid thread index '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid thread index '%s'",
+ option_arg.str().c_str());
}
break;
case 'f':
if (option_arg.getAsInteger(0, m_frame_idx)) {
m_frame_idx = LLDB_INVALID_FRAME_ID;
- error.SetErrorStringWithFormat("invalid frame index '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid frame index '%s'",
+ option_arg.str().c_str());
}
break;
case 'm': {
@@ -1118,7 +1118,8 @@ public:
case 't': {
if (option_arg.getAsInteger(0, m_thread_id)) {
m_thread_id = LLDB_INVALID_THREAD_ID;
- return Status("Invalid thread ID: '%s'.", option_arg.str().c_str());
+ return Status::FromErrorStringWithFormat("Invalid thread ID: '%s'.",
+ option_arg.str().c_str());
}
break;
}
@@ -1489,7 +1490,7 @@ public:
if (success)
m_from_expression = tmp_value;
else {
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid boolean value '%s' for 'x' option",
option_arg.str().c_str());
}
@@ -1641,15 +1642,17 @@ public:
case 'f':
m_filenames.AppendIfUnique(FileSpec(option_arg));
if (m_filenames.GetSize() > 1)
- return Status("only one source file expected.");
+ return Status::FromErrorString("only one source file expected.");
break;
case 'l':
if (option_arg.getAsInteger(0, m_line_num))
- return Status("invalid line number: '%s'.", option_arg.str().c_str());
+ return Status::FromErrorStringWithFormat("invalid line number: '%s'.",
+ option_arg.str().c_str());
break;
case 'b':
if (option_arg.getAsInteger(0, m_line_offset))
- return Status("invalid line offset: '%s'.", option_arg.str().c_str());
+ return Status::FromErrorStringWithFormat("invalid line offset: '%s'.",
+ option_arg.str().c_str());
break;
case 'a':
m_load_addr = OptionArgParser::ToAddress(execution_context, option_arg,
@@ -1774,7 +1777,8 @@ public:
case 't':
lldb::tid_t tid;
if (option_arg.getAsInteger(0, tid))
- return Status("invalid tid: '%s'.", option_arg.str().c_str());
+ return Status::FromErrorStringWithFormat("invalid tid: '%s'.",
+ option_arg.str().c_str());
m_tids.push_back(tid);
break;
case 'u':
@@ -2235,7 +2239,7 @@ public:
int32_t count;
if (option_arg.empty() || option_arg.getAsInteger(0, count) ||
count < 0)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid integer value for option '%s'",
option_arg.str().c_str());
else
@@ -2249,7 +2253,7 @@ public:
case 's': {
int32_t skip;
if (option_arg.empty() || option_arg.getAsInteger(0, skip) || skip < 0)
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid integer value for option '%s'",
option_arg.str().c_str());
else
@@ -2259,7 +2263,7 @@ public:
case 'i': {
uint64_t id;
if (option_arg.empty() || option_arg.getAsInteger(0, id))
- error.SetErrorStringWithFormat(
+ error = Status::FromErrorStringWithFormat(
"invalid integer value for option '%s'",
option_arg.str().c_str());
else
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 46537dd..f978652 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -312,8 +312,8 @@ private:
case 'C':
m_cascade = OptionArgParser::ToBoolean(option_arg, true, &success);
if (!success)
- error.SetErrorStringWithFormat("invalid value for cascade: %s",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid value for cascade: %s", option_arg.str().c_str());
break;
case 'P':
handwrite_python = true;
@@ -333,14 +333,14 @@ private:
break;
case 'x':
if (m_match_type == eFormatterMatchCallback)
- error.SetErrorString(
+ error = Status::FromErrorString(
"can't use --regex and --recognizer-function at the same time");
else
m_match_type = eFormatterMatchRegex;
break;
case '\x01':
if (m_match_type == eFormatterMatchRegex)
- error.SetErrorString(
+ error = Status::FromErrorString(
"can't use --regex and --recognizer-function at the same time");
else
m_match_type = eFormatterMatchCallback;
@@ -543,8 +543,8 @@ private:
case 'C':
m_cascade = OptionArgParser::ToBoolean(option_value, true, &success);
if (!success)
- error.SetErrorStringWithFormat("invalid value for cascade: %s",
- option_value.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid value for cascade: %s", option_value.str().c_str());
break;
case 'p':
m_skip_pointers = true;
@@ -1148,8 +1148,8 @@ Status CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue(
case 'C':
m_flags.SetCascades(OptionArgParser::ToBoolean(option_arg, true, &success));
if (!success)
- error.SetErrorStringWithFormat("invalid value for cascade: %s",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid value for cascade: %s",
+ option_arg.str().c_str());
break;
case 'e':
m_flags.SetDontShowChildren(false);
@@ -1174,14 +1174,14 @@ Status CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue(
break;
case 'x':
if (m_match_type == eFormatterMatchCallback)
- error.SetErrorString(
+ error = Status::FromErrorString(
"can't use --regex and --recognizer-function at the same time");
else
m_match_type = eFormatterMatchRegex;
break;
case '\x01':
if (m_match_type == eFormatterMatchRegex)
- error.SetErrorString(
+ error = Status::FromErrorString(
"can't use --regex and --recognizer-function at the same time");
else
m_match_type = eFormatterMatchCallback;
@@ -1577,7 +1577,7 @@ bool CommandObjectTypeSummaryAdd::AddSummary(ConstString type_name,
RegularExpression typeRX(type_name.GetStringRef());
if (!typeRX.IsValid()) {
if (error)
- error->SetErrorString(
+ *error = Status::FromErrorString(
"regex format error (maybe this is not really a regex?)");
return false;
}
@@ -1587,7 +1587,7 @@ bool CommandObjectTypeSummaryAdd::AddSummary(ConstString type_name,
const char *function_name = type_name.AsCString();
ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter && !interpreter->CheckObjectExists(function_name)) {
- error->SetErrorStringWithFormat(
+ *error = Status::FromErrorStringWithFormat(
"The provided recognizer function \"%s\" does not exist - "
"please define it before attempting to use this summary.\n",
function_name);
@@ -1764,8 +1764,8 @@ class CommandObjectTypeCategoryEnable : public CommandObjectParsed {
if (!option_arg.empty()) {
m_language = Language::GetLanguageTypeFromString(option_arg);
if (m_language == lldb::eLanguageTypeUnknown)
- error.SetErrorStringWithFormat("unrecognized language '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "unrecognized language '%s'", option_arg.str().c_str());
}
break;
default:
@@ -1906,8 +1906,8 @@ class CommandObjectTypeCategoryDisable : public CommandObjectParsed {
if (!option_arg.empty()) {
m_language = Language::GetLanguageTypeFromString(option_arg);
if (m_language == lldb::eLanguageTypeUnknown)
- error.SetErrorStringWithFormat("unrecognized language '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "unrecognized language '%s'", option_arg.str().c_str());
}
break;
default:
@@ -2227,9 +2227,10 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name,
if (category->AnyMatches(candidate_type, eFormatCategoryItemFilter,
false)) {
if (error)
- error->SetErrorStringWithFormat("cannot add synthetic for type %s when "
- "filter is defined in same category!",
- type_name.AsCString());
+ *error = Status::FromErrorStringWithFormat(
+ "cannot add synthetic for type %s when "
+ "filter is defined in same category!",
+ type_name.AsCString());
return false;
}
}
@@ -2238,7 +2239,7 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name,
RegularExpression typeRX(type_name.GetStringRef());
if (!typeRX.IsValid()) {
if (error)
- error->SetErrorString(
+ *error = Status::FromErrorString(
"regex format error (maybe this is not really a regex?)");
return false;
}
@@ -2248,7 +2249,7 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name,
const char *function_name = type_name.AsCString();
ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (interpreter && !interpreter->CheckObjectExists(function_name)) {
- error->SetErrorStringWithFormat(
+ *error = Status::FromErrorStringWithFormat(
"The provided recognizer function \"%s\" does not exist - "
"please define it before attempting to use this summary.\n",
function_name);
@@ -2283,8 +2284,8 @@ private:
case 'C':
m_cascade = OptionArgParser::ToBoolean(option_arg, true, &success);
if (!success)
- error.SetErrorStringWithFormat("invalid value for cascade: %s",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat(
+ "invalid value for cascade: %s", option_arg.str().c_str());
break;
case 'c':
m_expr_paths.push_back(std::string(option_arg));
@@ -2368,10 +2369,11 @@ private:
if (category->AnyMatches(candidate_type, eFormatCategoryItemSynth,
false)) {
if (error)
- error->SetErrorStringWithFormat("cannot add filter for type %s when "
- "synthetic is defined in same "
- "category!",
- type_name.AsCString());
+ *error = Status::FromErrorStringWithFormat(
+ "cannot add filter for type %s when "
+ "synthetic is defined in same "
+ "category!",
+ type_name.AsCString());
return false;
}
}
@@ -2382,7 +2384,7 @@ private:
RegularExpression typeRX(type_name.GetStringRef());
if (!typeRX.IsValid()) {
if (error)
- error->SetErrorString(
+ *error = Status::FromErrorString(
"regex format error (maybe this is not really a regex?)");
return false;
}
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index 126982d..f8f1fac 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -559,8 +559,8 @@ public:
switch (short_option) {
case 'i':
if (option_arg.getAsInteger(0, m_ignore_count))
- error.SetErrorStringWithFormat("invalid ignore count '%s'",
- option_arg.str().c_str());
+ error = Status::FromErrorStringWithFormat("invalid ignore count '%s'",
+ option_arg.str().c_str());
break;
default:
llvm_unreachable("Unimplemented option");
diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
index cc4cb76..ab1a2b3 100644
--- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -309,9 +309,8 @@ are no syntax errors may indicate that a function was declared but never called.
m_stop_on_error =
OptionArgParser::ToBoolean(option_arg, false, &success);
if (!success)
- error.SetErrorStringWithFormat(
- "invalid value for stop-on-error: \"%s\"",
- option_arg.str().c_str());
+ return Status::FromErrorStringWithFormatv(
+ "invalid value for stop-on-error: \"{0}\"", option_arg);
} break;
case 'F':
diff --git a/lldb/source/Commands/CommandOptionsProcessAttach.cpp b/lldb/source/Commands/CommandOptionsProcessAttach.cpp
index d3d864d..2a19862 100644
--- a/lldb/source/Commands/CommandOptionsProcessAttach.cpp
+++ b/lldb/source/Commands/CommandOptionsProcessAttach.cpp
@@ -41,8 +41,8 @@ Status CommandOptionsProcessAttach::SetOptionValue(
case 'p': {
lldb::pid_t pid;
if (option_arg.getAsInteger(0, pid)) {
- error.SetErrorStringWithFormat("invalid process ID '%s'",
- option_arg.str().c_str());
+ return Status::FromErrorStringWithFormatv("invalid process ID '{0}'",
+ option_arg);
} else {
attach_info.SetProcessID(pid);
}
diff --git a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
index b1c13d4..21d94d6 100644
--- a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
+++ b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
@@ -107,7 +107,7 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
if (success)
disable_aslr = disable_aslr_arg ? eLazyBoolYes : eLazyBoolNo;
else
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"Invalid boolean value for disable-aslr option: '%s'",
option_arg.empty() ? "<null>" : option_arg.str().c_str());
break;
@@ -121,7 +121,7 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
if (success)
launch_info.SetShellExpandArguments(expand_args);
else
- error.SetErrorStringWithFormat(
+ return Status::FromErrorStringWithFormat(
"Invalid boolean value for shell-expand-args option: '%s'",
option_arg.empty() ? "<null>" : option_arg.str().c_str());
break;
@@ -139,9 +139,8 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
break;
default:
- error.SetErrorStringWithFormat("unrecognized short option character '%c'",
- short_option);
- break;
+ return Status::FromErrorStringWithFormat(
+ "unrecognized short option character '%c'", short_option);
}
return error;
}