diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Interpreter')
39 files changed, 307 insertions, 296 deletions
diff --git a/contrib/llvm/tools/lldb/source/Interpreter/Args.cpp b/contrib/llvm/tools/lldb/source/Interpreter/Args.cpp index 6984328..a23ba30 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/Args.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/Args.cpp @@ -12,18 +12,15 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" #include "lldb/DataFormatters/FormatManager.h" -#include "lldb/Host/StringConvert.h" +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/Options.h" -#include "lldb/Target/Process.h" -#include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" @@ -423,10 +420,10 @@ void Args::SetArguments(const char **argv) { SetArguments(ArgvToArgc(argv), argv); } -Error Args::ParseOptions(Options &options, ExecutionContext *execution_context, - PlatformSP platform_sp, bool require_validation) { +Status Args::ParseOptions(Options &options, ExecutionContext *execution_context, + PlatformSP platform_sp, bool require_validation) { StreamString sstr; - Error error; + Status error; Option *long_options = options.GetLongOptions(); if (long_options == nullptr) { error.SetErrorStringWithFormat("invalid long options"); @@ -550,7 +547,7 @@ void Args::Clear() { lldb::addr_t Args::StringToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, - Error *error_ptr) { + Status *error_ptr) { bool error_set = false; if (s.empty()) { if (error_ptr) @@ -632,10 +629,8 @@ lldb::addr_t Args::StringToAddress(const ExecutionContext *exe_ctx, add = str[0] == '+'; if (regex_match.GetMatchAtIndex(s, 3, str)) { - offset = StringConvert::ToUInt64(str.c_str(), 0, 0, &success); - - if (success) { - Error error; + if (!llvm::StringRef(str).getAsInteger(0, offset)) { + Status error; addr = StringToAddress(exe_ctx, name.c_str(), LLDB_INVALID_ADDRESS, &error); if (addr != LLDB_INVALID_ADDRESS) { @@ -779,7 +774,7 @@ const char *Args::GetShellSafeArgument(const FileSpec &shell, int64_t Args::StringToOptionEnum(llvm::StringRef s, OptionEnumValueElement *enum_values, - int32_t fail_value, Error &error) { + int32_t fail_value, Status &error) { error.Clear(); if (!enum_values) { error.SetErrorString("invalid enumeration argument"); @@ -824,10 +819,10 @@ Args::StringToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, return fail_value; } -Error Args::StringToFormat(const char *s, lldb::Format &format, - size_t *byte_size_ptr) { +Status Args::StringToFormat(const char *s, lldb::Format &format, + size_t *byte_size_ptr) { format = eFormatInvalid; - Error error; + Status error; if (s && s[0]) { if (byte_size_ptr) { @@ -931,12 +926,12 @@ bool Args::ContainsEnvironmentVariable(llvm::StringRef env_var_name, // Check each arg to see if it matches the env var name. for (auto arg : llvm::enumerate(m_entries)) { llvm::StringRef name, value; - std::tie(name, value) = arg.Value.ref.split('='); + std::tie(name, value) = arg.value().ref.split('='); if (name != env_var_name) continue; if (argument_index) - *argument_index = arg.Index; + *argument_index = arg.index(); return true; } @@ -954,9 +949,9 @@ size_t Args::FindArgumentIndexForOption(Option *long_options, long_options[long_options_index].definition->long_option); for (auto entry : llvm::enumerate(m_entries)) { - if (entry.Value.ref.startswith(short_buffer) || - entry.Value.ref.startswith(long_buffer)) - return entry.Index; + if (entry.value().ref.startswith(short_buffer) || + entry.value().ref.startswith(long_buffer)) + return entry.index(); } return size_t(-1); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/CommandAlias.cpp b/contrib/llvm/tools/lldb/source/Interpreter/CommandAlias.cpp index a8f5343..2db7460 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/CommandAlias.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/CommandAlias.cpp @@ -11,11 +11,11 @@ #include "llvm/Support/ErrorHandling.h" -#include "lldb/Core/StreamString.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/contrib/llvm/tools/lldb/source/Interpreter/CommandHistory.cpp b/contrib/llvm/tools/lldb/source/Interpreter/CommandHistory.cpp index c16f713..ca5c906 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/CommandHistory.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/CommandHistory.cpp @@ -9,7 +9,6 @@ #include <inttypes.h> -#include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/CommandHistory.h" using namespace lldb; @@ -48,13 +47,13 @@ CommandHistory::FindString(llvm::StringRef input_str) const { size_t idx = 0; if (input_str.front() == '-') { - if (input_str.drop_front(2).getAsInteger(0, idx)) + if (input_str.drop_front(1).getAsInteger(0, idx)) return llvm::None; if (idx >= m_history.size()) return llvm::None; idx = m_history.size() - idx; } else { - if (input_str.drop_front().getAsInteger(0, idx)) + if (input_str.getAsInteger(0, idx)) return llvm::None; if (idx >= m_history.size()) return llvm::None; diff --git a/contrib/llvm/tools/lldb/source/Interpreter/CommandInterpreter.cpp b/contrib/llvm/tools/lldb/source/Interpreter/CommandInterpreter.cpp index d44eb25..986be7f 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/CommandInterpreter.cpp @@ -42,12 +42,12 @@ #include "../Commands/CommandObjectWatchpoint.h" #include "lldb/Core/Debugger.h" -#include "lldb/Core/Log.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/State.h" -#include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/Timer.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/Timer.h" #ifndef LLDB_DISABLE_LIBEDIT #include "lldb/Host/Editline.h" @@ -169,7 +169,8 @@ bool CommandInterpreter::GetSpaceReplPrompts() const { } void CommandInterpreter::Initialize() { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION); + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); CommandReturnObject result; @@ -391,7 +392,8 @@ const char *CommandInterpreter::ProcessEmbeddedScriptCommands(const char *arg) { } void CommandInterpreter::LoadCommandDictionary() { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION); + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); lldb::ScriptLanguage script_language = m_debugger.GetScriptLanguage(); @@ -645,8 +647,8 @@ void CommandInterpreter::LoadCommandDictionary() { "gdb-remote [<hostname>:]<portnum>", 2, 0, false)); if (connect_gdb_remote_cmd_ap.get()) { if (connect_gdb_remote_cmd_ap->AddRegexCommand( - "^([^:]+:[[:digit:]]+)$", - "process connect --plugin gdb-remote connect://%1") && + "^([^:]+|\\[[0-9a-fA-F:]+.*\\]):([0-9]+)$", + "process connect --plugin gdb-remote connect://%1:%2") && connect_gdb_remote_cmd_ap->AddRegexCommand( "^([[:digit:]]+)$", "process connect --plugin gdb-remote connect://localhost:%1")) { @@ -1373,7 +1375,7 @@ CommandObject *CommandInterpreter::BuildAliasResult( return alias_cmd_obj; } -Error CommandInterpreter::PreprocessCommand(std::string &command) { +Status CommandInterpreter::PreprocessCommand(std::string &command) { // The command preprocessor needs to do things to the command // line before any parsing of arguments or anything else is done. // The only current stuff that gets preprocessed is anything enclosed @@ -1381,7 +1383,7 @@ Error CommandInterpreter::PreprocessCommand(std::string &command) { // the result of the expression must be a scalar that can be substituted // into the command. An example would be: // (lldb) memory read `$rsp + 20` - Error error; // Error for any expressions that might not evaluate + Status error; // Status for any expressions that might not evaluate size_t start_backtick; size_t pos = 0; while ((start_backtick = command.find('`', pos)) != std::string::npos) { @@ -1533,8 +1535,8 @@ bool CommandInterpreter::HandleCommand(const char *command_line, if (log) log->Printf("Processing command: %s", command_line); - Timer scoped_timer(LLVM_PRETTY_FUNCTION, "Handling command: %s.", - command_line); + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Handling command: %s.", command_line); if (!no_context_switching) UpdateExecutionContext(override_context); @@ -1601,7 +1603,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line, return true; } - Error error(PreprocessCommand(command_string)); + Status error(PreprocessCommand(command_string)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -2018,8 +2020,8 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj, } for (auto entry : llvm::enumerate(cmd_args.entries())) { - if (!used[entry.Index] && !wants_raw_input) - new_args.AppendArgument(entry.Value.ref); + if (!used[entry.index()] && !wants_raw_input) + new_args.AppendArgument(entry.value().ref); } cmd_args.Clear(); @@ -2355,8 +2357,8 @@ void CommandInterpreter::HandleCommandsFromFile( StreamFileSP input_file_sp(new StreamFile()); std::string cmd_file_path = cmd_file.GetPath(); - Error error = input_file_sp->GetFile().Open(cmd_file_path.c_str(), - File::eOpenOptionRead); + Status error = input_file_sp->GetFile().Open(cmd_file_path.c_str(), + File::eOpenOptionRead); if (error.Success()) { Debugger &debugger = GetDebugger(); @@ -2473,7 +2475,7 @@ void CommandInterpreter::HandleCommandsFromFile( } ScriptInterpreter *CommandInterpreter::GetScriptInterpreter(bool can_create) { - std::lock_guard<std::mutex> locker(m_script_interpreter_mutex); + std::lock_guard<std::recursive_mutex> locker(m_script_interpreter_mutex); if (!m_script_interpreter_sp) { if (!can_create) return nullptr; @@ -2542,14 +2544,6 @@ void CommandInterpreter::OutputFormattedHelpText(Stream &strm, OutputFormattedHelpText(strm, prefix_stream.GetString(), help_text); } -LLVM_ATTRIBUTE_ALWAYS_INLINE -static size_t nextWordLength(llvm::StringRef S) { - size_t pos = S.find_first_of(' '); - if (pos == llvm::StringRef::npos) - return S.size(); - return pos; -} - void CommandInterpreter::OutputHelpText(Stream &strm, llvm::StringRef word_text, llvm::StringRef separator, llvm::StringRef help_text, @@ -2568,6 +2562,11 @@ void CommandInterpreter::OutputHelpText(Stream &strm, llvm::StringRef word_text, uint32_t chars_left = max_columns; + auto nextWordLength = [](llvm::StringRef S) { + size_t pos = S.find_first_of(' '); + return pos == llvm::StringRef::npos ? S.size() : pos; + }; + while (!text.empty()) { if (text.front() == '\n' || (text.front() == ' ' && nextWordLength(text.ltrim(' ')) < chars_left)) { @@ -2656,7 +2655,7 @@ size_t CommandInterpreter::GetProcessOutput() { char stdio_buffer[1024]; size_t len; size_t total_bytes = 0; - Error error; + Status error; TargetSP target_sp(m_debugger.GetTargetList().GetSelectedTarget()); if (target_sp) { ProcessSP process_sp(target_sp->GetProcessSP()); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/CommandObject.cpp b/contrib/llvm/tools/lldb/source/Interpreter/CommandObject.cpp index 944d408..f9a5b10 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/CommandObject.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/CommandObject.cpp @@ -24,9 +24,9 @@ // FIXME: Make a separate file for the completers. #include "lldb/Core/FileSpecList.h" #include "lldb/DataFormatters/FormatManager.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/Target/Language.h" @@ -99,7 +99,7 @@ bool CommandObject::ParseOptions(Args &args, CommandReturnObject &result) { // See if the subclass has options? Options *options = GetOptions(); if (options != nullptr) { - Error error; + Status error; auto exe_ctx = GetCommandInterpreter().GetExecutionContext(); options->NotifyOptionParsingStarting(&exe_ctx); @@ -977,10 +977,10 @@ bool CommandObjectParsed::Execute(const char *args_string, } if (!handled) { for (auto entry : llvm::enumerate(cmd_args.entries())) { - if (!entry.Value.ref.empty() && entry.Value.ref.front() == '`') { + if (!entry.value().ref.empty() && entry.value().ref.front() == '`') { cmd_args.ReplaceArgumentAtIndex( - entry.Index, - m_interpreter.ProcessEmbeddedScriptCommands(entry.Value.c_str())); + entry.index(), + m_interpreter.ProcessEmbeddedScriptCommands(entry.value().c_str())); } } diff --git a/contrib/llvm/tools/lldb/source/Interpreter/CommandReturnObject.cpp b/contrib/llvm/tools/lldb/source/Interpreter/CommandReturnObject.cpp index 72e66aa..75c0258 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/CommandReturnObject.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/CommandReturnObject.cpp @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" -#include "lldb/Core/StreamString.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; @@ -111,7 +111,7 @@ void CommandReturnObject::AppendError(llvm::StringRef in_string) { GetErrorStream() << "error: " << in_string << "\n"; } -void CommandReturnObject::SetError(const Error &error, +void CommandReturnObject::SetError(const Status &error, const char *fallback_error_cstr) { const char *error_cstr = error.AsCString(); if (error_cstr == nullptr) @@ -127,7 +127,7 @@ void CommandReturnObject::SetError(llvm::StringRef error_str) { SetStatus(eReturnStatusFailed); } -// Similar to AppendError, but do not prepend 'Error: ' to message, and +// Similar to AppendError, but do not prepend 'Status: ' to message, and // don't append "\n" to the end of it. void CommandReturnObject::AppendRawError(llvm::StringRef in_string) { diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupArchitecture.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupArchitecture.cpp index 51245a8..d5354fe 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupArchitecture.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupArchitecture.cpp @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Utility/Utils.h" +#include "lldb/Host/OptionParser.h" using namespace lldb; using namespace lldb_private; @@ -41,10 +41,11 @@ bool OptionGroupArchitecture::GetArchitecture(Platform *platform, return arch.IsValid(); } -Error OptionGroupArchitecture::SetOptionValue( - uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupArchitecture::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupBoolean.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupBoolean.cpp index 10b9746..5fd4ce7 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupBoolean.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupBoolean.cpp @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/OptionParser.h" using namespace lldb; using namespace lldb_private; @@ -39,10 +40,10 @@ OptionGroupBoolean::OptionGroupBoolean(uint32_t usage_mask, bool required, OptionGroupBoolean::~OptionGroupBoolean() {} -Error OptionGroupBoolean::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_value, - ExecutionContext *execution_context) { - Error error; +Status OptionGroupBoolean::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_value, + ExecutionContext *execution_context) { + Status error; if (m_option_definition.option_has_arg == OptionParser::eNoArgument) { // Not argument, toggle the default value and mark the option as having been // set diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupFile.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupFile.cpp index 0c0b068..d45f00a 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupFile.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupFile.cpp @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/OptionParser.h" using namespace lldb; using namespace lldb_private; @@ -37,10 +38,10 @@ OptionGroupFile::OptionGroupFile(uint32_t usage_mask, bool required, OptionGroupFile::~OptionGroupFile() {} -Error OptionGroupFile::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error(m_file.SetValueFromString(option_arg)); +Status OptionGroupFile::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error(m_file.SetValueFromString(option_arg)); return error; } @@ -68,10 +69,11 @@ OptionGroupFileList::OptionGroupFileList( OptionGroupFileList::~OptionGroupFileList() {} -Error OptionGroupFileList::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_value, - ExecutionContext *execution_context) { - Error error(m_file_list.SetValueFromString(option_value)); +Status +OptionGroupFileList::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_value, + ExecutionContext *execution_context) { + Status error(m_file_list.SetValueFromString(option_value)); return error; } diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupFormat.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupFormat.cpp index c97d16a..7c4239f 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupFormat.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupFormat.cpp @@ -14,10 +14,10 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/ArchSpec.h" +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Utils.h" using namespace lldb; using namespace lldb_private; @@ -58,10 +58,10 @@ llvm::ArrayRef<OptionDefinition> OptionGroupFormat::GetDefinitions() { return result.take_front(2); } -Error OptionGroupFormat::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status OptionGroupFormat::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { @@ -235,32 +235,36 @@ bool OptionGroupFormat::ParserGDBFormatLetter( m_prev_gdb_format = format_letter; return true; - // Size isn't used for printing instructions, so if a size is specified, and - // the previous format was - // 'i', then we should reset it to the default ('x'). Otherwise we'll - // continue to print as instructions, - // which isn't expected. case 'b': - byte_size = 1; - LLVM_FALLTHROUGH; case 'h': - byte_size = 2; - LLVM_FALLTHROUGH; case 'w': - byte_size = 4; - LLVM_FALLTHROUGH; case 'g': - byte_size = 8; - - m_prev_gdb_size = format_letter; - if (m_prev_gdb_format == 'i') - m_prev_gdb_format = 'x'; - return true; + { + // Size isn't used for printing instructions, so if a size is specified, and + // the previous format was + // 'i', then we should reset it to the default ('x'). Otherwise we'll + // continue to print as instructions, + // which isn't expected. + if (format_letter == 'b') + byte_size = 1; + else if (format_letter == 'h') + byte_size = 2; + else if (format_letter == 'w') + byte_size = 4; + else if (format_letter == 'g') + byte_size = 8; + m_prev_gdb_size = format_letter; + if (m_prev_gdb_format == 'i') + m_prev_gdb_format = 'x'; + return true; + } break; default: break; } + + return false; } diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupOutputFile.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupOutputFile.cpp index b9538fb..fd40649 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupOutputFile.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupOutputFile.cpp @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Utility/Utils.h" +#include "lldb/Host/OptionParser.h" using namespace lldb; using namespace lldb_private; @@ -38,10 +38,11 @@ llvm::ArrayRef<OptionDefinition> OptionGroupOutputFile::GetDefinitions() { return llvm::makeArrayRef(g_option_table); } -Error OptionGroupOutputFile::SetOptionValue( - uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupOutputFile::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupPlatform.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupPlatform.cpp index 6231162..5747c6a 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupPlatform.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupPlatform.cpp @@ -13,16 +13,16 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Target/Platform.h" -#include "lldb/Utility/Utils.h" using namespace lldb; using namespace lldb_private; PlatformSP OptionGroupPlatform::CreatePlatformWithOptions( CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, - Error &error, ArchSpec &platform_arch) const { + Status &error, ArchSpec &platform_arch) const { PlatformSP platform_sp; if (!m_platform_name.empty()) { @@ -92,10 +92,11 @@ llvm::ArrayRef<OptionDefinition> OptionGroupPlatform::GetDefinitions() { return result.drop_front(); } -Error OptionGroupPlatform::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupPlatform::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; if (!m_include_platform_option) ++option_idx; diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupString.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupString.cpp index 48a9ff1..1a16194 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupString.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupString.cpp @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/OptionParser.h" using namespace lldb; using namespace lldb_private; @@ -38,10 +39,10 @@ OptionGroupString::OptionGroupString(uint32_t usage_mask, bool required, OptionGroupString::~OptionGroupString() {} -Error OptionGroupString::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error(m_value.SetValueFromString(option_arg)); +Status OptionGroupString::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error(m_value.SetValueFromString(option_arg)); return error; } diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUInt64.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUInt64.cpp index a8501fa..ae4828c 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUInt64.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUInt64.cpp @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/OptionParser.h" using namespace lldb; using namespace lldb_private; @@ -38,10 +39,10 @@ OptionGroupUInt64::OptionGroupUInt64(uint32_t usage_mask, bool required, OptionGroupUInt64::~OptionGroupUInt64() {} -Error OptionGroupUInt64::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error(m_value.SetValueFromString(option_arg)); +Status OptionGroupUInt64::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error(m_value.SetValueFromString(option_arg)); return error; } diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUUID.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUUID.cpp index cd6c02a..bf02d1b 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUUID.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupUUID.cpp @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Utility/Utils.h" +#include "lldb/Host/OptionParser.h" using namespace lldb; using namespace lldb_private; @@ -31,10 +31,10 @@ llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() { return llvm::makeArrayRef(g_option_table); } -Error OptionGroupUUID::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status OptionGroupUUID::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp index 6d33132..ce27d94 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp @@ -14,10 +14,9 @@ // Other libraries and framework includes // Project includes #include "lldb/DataFormatters/ValueObjectPrinter.h" -#include "lldb/Host/StringConvert.h" +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Utils.h" #include "llvm/ADT/ArrayRef.h" @@ -76,10 +75,10 @@ OptionGroupValueObjectDisplay::GetDefinitions() { return llvm::makeArrayRef(g_option_table); } -Error OptionGroupValueObjectDisplay::SetOptionValue( +Status OptionGroupValueObjectDisplay::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; const int short_option = g_option_table[option_idx].short_option; bool success = false; diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupVariable.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupVariable.cpp index c257506..0793d37 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupVariable.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupVariable.cpp @@ -13,11 +13,11 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" #include "lldb/DataFormatters/DataVisualization.h" +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Utils.h" +#include "lldb/Utility/Status.h" using namespace lldb; using namespace lldb_private; @@ -52,20 +52,20 @@ static OptionDefinition g_variable_options[] = { "Specify a summary string to use to format the variable output."}, }; -static Error ValidateNamedSummary(const char *str, void *) { +static Status ValidateNamedSummary(const char *str, void *) { if (!str || !str[0]) - return Error("must specify a valid named summary"); + return Status("must specify a valid named summary"); TypeSummaryImplSP summary_sp; if (DataVisualization::NamedSummaryFormats::GetSummaryFormat( ConstString(str), summary_sp) == false) - return Error("must specify a valid named summary"); - return Error(); + return Status("must specify a valid named summary"); + return Status(); } -static Error ValidateSummaryString(const char *str, void *) { +static Status ValidateSummaryString(const char *str, void *) { if (!str || !str[0]) - return Error("must specify a non-empty summary string"); - return Error(); + return Status("must specify a non-empty summary string"); + return Status(); } OptionGroupVariable::OptionGroupVariable(bool show_frame_options) @@ -74,10 +74,11 @@ OptionGroupVariable::OptionGroupVariable(bool show_frame_options) OptionGroupVariable::~OptionGroupVariable() {} -Error OptionGroupVariable::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupVariable::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; if (!include_frame_options) option_idx += 3; const int short_option = g_variable_options[option_idx].short_option; diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupWatchpoint.cpp index cda934b..dd4b8c8 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupWatchpoint.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionGroupWatchpoint.cpp @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/Args.h" -#include "lldb/Utility/Utils.h" #include "lldb/lldb-enumerations.h" using namespace lldb; @@ -56,10 +56,11 @@ OptionGroupWatchpoint::OptionGroupWatchpoint() : OptionGroup() {} OptionGroupWatchpoint::~OptionGroupWatchpoint() {} -Error OptionGroupWatchpoint::SetOptionValue( - uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) { - Error error; +Status +OptionGroupWatchpoint::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_arg, + ExecutionContext *execution_context) { + Status error; const int short_option = g_option_table[option_idx].short_option; switch (short_option) { case 'w': { diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValue.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValue.cpp index 58de32c..afcace2 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValue.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValue.cpp @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/StringList.h" #include "lldb/Interpreter/OptionValues.h" +#include "lldb/Utility/StringList.h" using namespace lldb; using namespace lldb_private; @@ -42,10 +42,10 @@ uint64_t OptionValue::GetUInt64Value(uint64_t fail_value, bool *success_ptr) { return fail_value; } -Error OptionValue::SetSubValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, llvm::StringRef name, - llvm::StringRef value) { - Error error; +Status OptionValue::SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, llvm::StringRef name, + llvm::StringRef value) { + Status error; error.SetErrorStringWithFormat("SetSubValue is not supported"); return error; } @@ -507,7 +507,7 @@ const char *OptionValue::GetBuiltinTypeAsCString(Type t) { } lldb::OptionValueSP OptionValue::CreateValueFromCStringForTypeMask( - const char *value_cstr, uint32_t type_mask, Error &error) { + const char *value_cstr, uint32_t type_mask, Status &error) { // If only 1 bit is set in the type mask for a dictionary or array // then we know how to decode a value from a cstring lldb::OptionValueSP value_sp; @@ -582,9 +582,9 @@ size_t OptionValue::AutoComplete(CommandInterpreter &interpreter, return matches.GetSize(); } -Error OptionValue::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValue::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationReplace: error.SetErrorStringWithFormat( diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArch.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArch.cpp index 3e41300..1d920a1 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArch.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArch.cpp @@ -38,9 +38,9 @@ void OptionValueArch::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueArch::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueArch::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp index 9dc4633..8b62070 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp @@ -13,9 +13,9 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" #include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -70,18 +70,19 @@ void OptionValueArray::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueArray::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { +Status OptionValueArray::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { Args args(value.str()); - Error error = SetArgs(args, op); + Status error = SetArgs(args, op); if (error.Success()) NotifyValueChanged(); return error; } lldb::OptionValueSP -OptionValueArray::GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, - bool will_modify, Error &error) const { +OptionValueArray::GetSubValue(const ExecutionContext *exe_ctx, + llvm::StringRef name, bool will_modify, + Status &error) const { if (name.empty() || name.front() != '[') { error.SetErrorStringWithFormat( "invalid value path '%s', %s values only support '[<index>]' subvalues " @@ -149,8 +150,8 @@ size_t OptionValueArray::GetArgs(Args &args) const { return args.GetArgumentCount(); } -Error OptionValueArray::SetArgs(const Args &args, VarSetOperationType op) { - Error error; +Status OptionValueArray::SetArgs(const Args &args, VarSetOperationType op) { + Status error; const size_t argc = args.GetArgumentCount(); switch (op) { case eVarSetOperationInvalid: diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp index 85799fe..2cb84cd 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp @@ -13,10 +13,10 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" -#include "lldb/Core/StringList.h" #include "lldb/Host/PosixApi.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StringList.h" #include "llvm/ADT/STLExtras.h" using namespace lldb; @@ -35,9 +35,9 @@ void OptionValueBoolean::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueBoolean::SetValueFromString(llvm::StringRef value_str, - VarSetOperationType op) { - Error error; +Status OptionValueBoolean::SetValueFromString(llvm::StringRef value_str, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueChar.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueChar.cpp index 6423185..27684a2 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueChar.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueChar.cpp @@ -13,9 +13,9 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" -#include "lldb/Core/StringList.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StringList.h" #include "llvm/ADT/STLExtras.h" using namespace lldb; @@ -36,9 +36,9 @@ void OptionValueChar::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueChar::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueChar::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueDictionary.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueDictionary.cpp index dfba435..b245a09 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueDictionary.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueDictionary.cpp @@ -90,8 +90,9 @@ size_t OptionValueDictionary::GetArgs(Args &args) const { return args.GetArgumentCount(); } -Error OptionValueDictionary::SetArgs(const Args &args, VarSetOperationType op) { - Error error; +Status OptionValueDictionary::SetArgs(const Args &args, + VarSetOperationType op) { + Status error; const size_t argc = args.GetArgumentCount(); switch (op) { case eVarSetOperationClear: @@ -197,10 +198,10 @@ Error OptionValueDictionary::SetArgs(const Args &args, VarSetOperationType op) { return error; } -Error OptionValueDictionary::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { +Status OptionValueDictionary::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { Args args(value.str()); - Error error = SetArgs(args, op); + Status error = SetArgs(args, op); if (error.Success()) NotifyValueChanged(); return error; @@ -208,8 +209,8 @@ Error OptionValueDictionary::SetValueFromString(llvm::StringRef value, lldb::OptionValueSP OptionValueDictionary::GetSubValue(const ExecutionContext *exe_ctx, - llvm::StringRef name, bool will_modify, - Error &error) const { + llvm::StringRef name, bool will_modify, + Status &error) const { lldb::OptionValueSP value_sp; if (name.empty()) return nullptr; @@ -258,10 +259,11 @@ OptionValueDictionary::GetSubValue(const ExecutionContext *exe_ctx, return value_sp->GetSubValue(exe_ctx, sub_name, will_modify, error); } -Error OptionValueDictionary::SetSubValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, - llvm::StringRef name, llvm::StringRef value) { - Error error; +Status OptionValueDictionary::SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef name, + llvm::StringRef value) { + Status error; const bool will_modify = true; lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error)); if (value_sp) diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueEnumeration.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueEnumeration.cpp index 679b5cc..9510f4a 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueEnumeration.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueEnumeration.cpp @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/StringList.h" +#include "lldb/Utility/StringList.h" using namespace lldb; using namespace lldb_private; @@ -37,7 +37,7 @@ void OptionValueEnumeration::DumpValue(const ExecutionContext *exe_ctx, const size_t count = m_enumerations.GetSize(); for (size_t i = 0; i < count; ++i) { if (m_enumerations.GetValueAtIndexUnchecked(i).value == m_current_value) { - strm.PutCString(m_enumerations.GetCStringAtIndex(i)); + strm.PutCString(m_enumerations.GetCStringAtIndex(i).GetStringRef()); return; } } @@ -45,9 +45,9 @@ void OptionValueEnumeration::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueEnumeration::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueEnumeration::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); @@ -58,8 +58,7 @@ Error OptionValueEnumeration::SetValueFromString(llvm::StringRef value, case eVarSetOperationAssign: { ConstString const_enumerator_name(value.trim()); const EnumerationMapEntry *enumerator_entry = - m_enumerations.FindFirstValueForName( - const_enumerator_name.GetStringRef()); + m_enumerations.FindFirstValueForName(const_enumerator_name); if (enumerator_entry) { m_current_value = enumerator_entry->value.value; NotifyValueChanged(); @@ -69,10 +68,10 @@ Error OptionValueEnumeration::SetValueFromString(llvm::StringRef value, const size_t count = m_enumerations.GetSize(); if (count) { error_strm.Printf(", valid values are: %s", - m_enumerations.GetCStringAtIndex(0).str().c_str()); + m_enumerations.GetCStringAtIndex(0).GetCString()); for (size_t i = 1; i < count; ++i) { error_strm.Printf(", %s", - m_enumerations.GetCStringAtIndex(i).str().c_str()); + m_enumerations.GetCStringAtIndex(i).GetCString()); } } error.SetErrorString(error_strm.GetString()); @@ -99,7 +98,7 @@ void OptionValueEnumeration::SetEnumerations( ConstString const_enumerator_name(enumerators[i].string_value); EnumeratorInfo enumerator_info = {enumerators[i].value, enumerators[i].usage}; - m_enumerations.Append(const_enumerator_name.GetStringRef(), + m_enumerations.Append(const_enumerator_name, enumerator_info); } m_enumerations.Sort(); @@ -119,14 +118,14 @@ size_t OptionValueEnumeration::AutoComplete( const uint32_t num_enumerators = m_enumerations.GetSize(); if (!s.empty()) { for (size_t i = 0; i < num_enumerators; ++i) { - llvm::StringRef name = m_enumerations.GetCStringAtIndex(i); + llvm::StringRef name = m_enumerations.GetCStringAtIndex(i).GetStringRef(); if (name.startswith(s)) matches.AppendString(name); } } else { // only suggest "true" or "false" by default for (size_t i = 0; i < num_enumerators; ++i) - matches.AppendString(m_enumerations.GetCStringAtIndex(i)); + matches.AppendString(m_enumerations.GetCStringAtIndex(i).GetStringRef()); } return matches.GetSize(); } diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpec.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpec.cpp index a6eb537..b235d4a 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -15,6 +15,7 @@ #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Utility/DataBufferLLVM.h" using namespace lldb; using namespace lldb_private; @@ -53,9 +54,9 @@ void OptionValueFileSpec::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueFileSpec::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueFileSpec::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); @@ -118,10 +119,8 @@ OptionValueFileSpec::GetFileContents(bool null_terminate) { const auto file_mod_time = FileSystem::GetModificationTime(m_current_value); if (m_data_sp && m_data_mod_time == file_mod_time) return m_data_sp; - if (null_terminate) - m_data_sp = m_current_value.ReadFileContentsAsCString(); - else - m_data_sp = m_current_value.ReadFileContents(); + m_data_sp = DataBufferLLVM::CreateFromPath(m_current_value.GetPath(), + null_terminate); m_data_mod_time = file_mod_time; } return m_data_sp; diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp index e4bd4ba..7773bdc 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp @@ -13,9 +13,9 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" #include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -38,9 +38,9 @@ void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueFileSpecList::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; Args args(value.str()); const size_t argc = args.GetArgumentCount(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFormat.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFormat.cpp index 041d8a5..24dd8fd 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFormat.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFormat.cpp @@ -13,9 +13,9 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" #include "lldb/DataFormatters/FormatManager.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -31,9 +31,9 @@ void OptionValueFormat::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueFormat::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueFormat::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFormatEntity.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFormatEntity.cpp index 03f077c..e9431d4 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFormatEntity.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueFormatEntity.cpp @@ -14,9 +14,9 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/Module.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StringList.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StringList.h" using namespace lldb; using namespace lldb_private; @@ -25,7 +25,7 @@ OptionValueFormatEntity::OptionValueFormatEntity(const char *default_format) m_default_entry() { if (default_format && default_format[0]) { llvm::StringRef default_format_str(default_format); - Error error = FormatEntity::Parse(default_format_str, m_default_entry); + Status error = FormatEntity::Parse(default_format_str, m_default_entry); if (error.Success()) { m_default_format = default_format; m_current_format = default_format; @@ -52,9 +52,9 @@ void OptionValueFormatEntity::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueFormatEntity::SetValueFromString(llvm::StringRef value_str, - VarSetOperationType op) { - Error error; +Status OptionValueFormatEntity::SetValueFromString(llvm::StringRef value_str, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueLanguage.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueLanguage.cpp index b3da6d3..3290e88 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueLanguage.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueLanguage.cpp @@ -13,10 +13,10 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" #include "lldb/DataFormatters/FormatManager.h" #include "lldb/Interpreter/Args.h" #include "lldb/Target/Language.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -32,9 +32,9 @@ void OptionValueLanguage::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueLanguage::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueLanguage::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValuePathMappings.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValuePathMappings.cpp index 5b9850d..5f80572 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValuePathMappings.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValuePathMappings.cpp @@ -13,10 +13,10 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -40,9 +40,9 @@ void OptionValuePathMappings::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValuePathMappings::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValuePathMappings::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; Args args(value.str()); const size_t argc = args.GetArgumentCount(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueProperties.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueProperties.cpp index 7e4df3a..ae76696 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueProperties.cpp @@ -13,13 +13,14 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Flags.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StringList.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Core/UserSettingsController.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/OptionValues.h" #include "lldb/Interpreter/Property.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StringList.h" using namespace lldb; using namespace lldb_private; @@ -58,7 +59,7 @@ void OptionValueProperties::Initialize(const PropertyDefinition *defs) { for (size_t i = 0; defs[i].name; ++i) { Property property(defs[i]); assert(property.IsValid()); - m_name_to_index.Append(property.GetName(), m_properties.size()); + m_name_to_index.Append(ConstString(property.GetName()), m_properties.size()); property.GetValue()->SetParent(shared_from_this()); m_properties.push_back(property); } @@ -77,7 +78,7 @@ void OptionValueProperties::AppendProperty(const ConstString &name, bool is_global, const OptionValueSP &value_sp) { Property property(name, desc, is_global, value_sp); - m_name_to_index.Append(name.GetStringRef(), m_properties.size()); + m_name_to_index.Append(name, m_properties.size()); m_properties.push_back(property); value_sp->SetParent(shared_from_this()); m_name_to_index.Sort(); @@ -107,7 +108,7 @@ OptionValueProperties::GetValueForKey(const ExecutionContext *exe_ctx, const ConstString &key, bool will_modify) const { lldb::OptionValueSP value_sp; - size_t idx = m_name_to_index.Find(key.GetStringRef(), SIZE_MAX); + size_t idx = m_name_to_index.Find(key, SIZE_MAX); if (idx < m_properties.size()) value_sp = GetPropertyAtIndex(exe_ctx, will_modify, idx)->GetValue(); return value_sp; @@ -115,8 +116,8 @@ OptionValueProperties::GetValueForKey(const ExecutionContext *exe_ctx, lldb::OptionValueSP OptionValueProperties::GetSubValue(const ExecutionContext *exe_ctx, - llvm::StringRef name, bool will_modify, - Error &error) const { + llvm::StringRef name, bool will_modify, + Status &error) const { lldb::OptionValueSP value_sp; if (name.empty()) return OptionValueSP(); @@ -200,10 +201,11 @@ OptionValueProperties::GetSubValue(const ExecutionContext *exe_ctx, return value_sp; } -Error OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, - llvm::StringRef name, llvm::StringRef value) { - Error error; +Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef name, + llvm::StringRef value) { + Status error; const bool will_modify = true; lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error)); if (value_sp) @@ -217,7 +219,7 @@ Error OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx, uint32_t OptionValueProperties::GetPropertyIndex(const ConstString &name) const { - return m_name_to_index.Find(name.GetStringRef(), SIZE_MAX); + return m_name_to_index.Find(name, SIZE_MAX); } const Property * @@ -226,7 +228,7 @@ OptionValueProperties::GetProperty(const ExecutionContext *exe_ctx, const ConstString &name) const { return GetPropertyAtIndex( exe_ctx, will_modify, - m_name_to_index.Find(name.GetStringRef(), SIZE_MAX)); + m_name_to_index.Find(name, SIZE_MAX)); } const Property *OptionValueProperties::GetPropertyAtIndex( @@ -522,9 +524,9 @@ bool OptionValueProperties::Clear() { return true; } -Error OptionValueProperties::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueProperties::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; // Args args(value_cstr); // const size_t argc = args.GetArgumentCount(); @@ -563,11 +565,11 @@ void OptionValueProperties::DumpValue(const ExecutionContext *exe_ctx, } } -Error OptionValueProperties::DumpPropertyValue(const ExecutionContext *exe_ctx, - Stream &strm, - llvm::StringRef property_path, - uint32_t dump_mask) { - Error error; +Status OptionValueProperties::DumpPropertyValue(const ExecutionContext *exe_ctx, + Stream &strm, + llvm::StringRef property_path, + uint32_t dump_mask) { + Status error; const bool will_modify = false; lldb::OptionValueSP value_sp( GetSubValue(exe_ctx, property_path, will_modify, error)); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueRegex.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueRegex.cpp index 86ef102..aee8f97 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueRegex.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueRegex.cpp @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -32,9 +32,9 @@ void OptionValueRegex::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueRegex::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueRegex::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationInvalid: case eVarSetOperationInsertBefore: diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueSInt64.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueSInt64.cpp index 3f3844a..9dbcd58 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueSInt64.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueSInt64.cpp @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" #include "lldb/Host/StringConvert.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -34,9 +34,9 @@ void OptionValueSInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueSInt64::SetValueFromString(llvm::StringRef value_ref, - VarSetOperationType op) { - Error error; +Status OptionValueSInt64::SetValueFromString(llvm::StringRef value_ref, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueString.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueString.cpp index e61ead0..1d7332d 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueString.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueString.cpp @@ -14,8 +14,9 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; @@ -46,9 +47,9 @@ void OptionValueString::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueString::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueString::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; std::string value_str = value.str(); value = value.trim(); @@ -126,27 +127,27 @@ lldb::OptionValueSP OptionValueString::DeepCopy() const { return OptionValueSP(new OptionValueString(*this)); } -Error OptionValueString::SetCurrentValue(llvm::StringRef value) { +Status OptionValueString::SetCurrentValue(llvm::StringRef value) { if (m_validator) { - Error error(m_validator(value.str().c_str(), m_validator_baton)); + Status error(m_validator(value.str().c_str(), m_validator_baton)); if (error.Fail()) return error; } m_current_value.assign(value); - return Error(); + return Status(); } -Error OptionValueString::AppendToCurrentValue(const char *value) { +Status OptionValueString::AppendToCurrentValue(const char *value) { if (value && value[0]) { if (m_validator) { std::string new_value(m_current_value); new_value.append(value); - Error error(m_validator(value, m_validator_baton)); + Status error(m_validator(value, m_validator_baton)); if (error.Fail()) return error; m_current_value.assign(new_value); } else m_current_value.append(value); } - return Error(); + return Status(); } diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueUInt64.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueUInt64.cpp index 8986080..c8db1bd 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueUInt64.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueUInt64.cpp @@ -14,14 +14,14 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" #include "lldb/Host/StringConvert.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; lldb::OptionValueSP OptionValueUInt64::Create(llvm::StringRef value_str, - Error &error) { + Status &error) { lldb::OptionValueSP value_sp(new OptionValueUInt64()); error = value_sp->SetValueFromString(value_str); if (error.Fail()) @@ -40,9 +40,9 @@ void OptionValueUInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueUInt64::SetValueFromString(llvm::StringRef value_ref, - VarSetOperationType op) { - Error error; +Status OptionValueUInt64::SetValueFromString(llvm::StringRef value_ref, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueUUID.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueUUID.cpp index 3519334..bec04cb 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueUUID.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueUUID.cpp @@ -14,9 +14,9 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/Module.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StringList.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StringList.h" using namespace lldb; using namespace lldb_private; @@ -32,9 +32,9 @@ void OptionValueUUID::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -Error OptionValueUUID::SetValueFromString(llvm::StringRef value, - VarSetOperationType op) { - Error error; +Status OptionValueUUID::SetValueFromString(llvm::StringRef value, + VarSetOperationType op) { + Status error; switch (op) { case eVarSetOperationClear: Clear(); diff --git a/contrib/llvm/tools/lldb/source/Interpreter/Options.cpp b/contrib/llvm/tools/lldb/source/Interpreter/Options.cpp index d26e53f..f8b1a8d 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/Options.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/Options.cpp @@ -18,12 +18,13 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StreamString.h" +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; @@ -41,8 +42,8 @@ void Options::NotifyOptionParsingStarting(ExecutionContext *execution_context) { OptionParsingStarting(execution_context); } -Error Options::NotifyOptionParsingFinished( - ExecutionContext *execution_context) { +Status +Options::NotifyOptionParsingFinished(ExecutionContext *execution_context) { return OptionParsingFinished(execution_context); } @@ -904,13 +905,13 @@ void OptionGroupOptions::Finalize() { m_did_finalize = true; } -Error OptionGroupOptions::SetOptionValue(uint32_t option_idx, - llvm::StringRef option_value, - ExecutionContext *execution_context) { +Status OptionGroupOptions::SetOptionValue(uint32_t option_idx, + llvm::StringRef option_value, + ExecutionContext *execution_context) { // After calling OptionGroupOptions::Append(...), you must finalize the groups // by calling OptionGroupOptions::Finlize() assert(m_did_finalize); - Error error; + Status error; if (option_idx < m_option_infos.size()) { error = m_option_infos[option_idx].option_group->SetOptionValue( m_option_infos[option_idx].option_index, option_value, @@ -934,10 +935,10 @@ void OptionGroupOptions::OptionParsingStarting( } } } -Error OptionGroupOptions::OptionParsingFinished( - ExecutionContext *execution_context) { +Status +OptionGroupOptions::OptionParsingFinished(ExecutionContext *execution_context) { std::set<OptionGroup *> group_set; - Error error; + Status error; OptionInfos::iterator pos, end = m_option_infos.end(); for (pos = m_option_infos.begin(); pos != end; ++pos) { OptionGroup *group = pos->option_group; diff --git a/contrib/llvm/tools/lldb/source/Interpreter/ScriptInterpreter.cpp b/contrib/llvm/tools/lldb/source/Interpreter/ScriptInterpreter.cpp index d87d24e..57f7eea 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/ScriptInterpreter.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/ScriptInterpreter.cpp @@ -13,11 +13,11 @@ #include <stdlib.h> #include <string> -#include "lldb/Core/Error.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StringList.h" +#include "lldb/Host/PseudoTerminal.h" #include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Utility/PseudoTerminal.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StringList.h" using namespace lldb; using namespace lldb_private; @@ -75,10 +75,10 @@ ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) { return eScriptLanguageUnknown; } -Error ScriptInterpreter::SetBreakpointCommandCallback( +Status ScriptInterpreter::SetBreakpointCommandCallback( std::vector<BreakpointOptions *> &bp_options_vec, const char *callback_text) { - Error return_error; + Status return_error; for (BreakpointOptions *bp_options : bp_options_vec) { return_error = SetBreakpointCommandCallback(bp_options, callback_text); if (return_error.Success()) |