aboutsummaryrefslogtreecommitdiffstats
path: root/source/Interpreter
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
commit94994d372d014ce4c8758b9605d63fae651bd8aa (patch)
tree51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /source/Interpreter
parent39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff)
downloadsrc-94994d372d014ce4c8758b9605d63fae651bd8aa.tar.gz
src-94994d372d014ce4c8758b9605d63fae651bd8aa.zip
Vendor import of lldb trunk r351319 (just before the release_80 branchvendor/lldb/lldb-trunk-r351319
Notes
Notes: svn path=/vendor/lldb/dist/; revision=343181 svn path=/vendor/lldb/lldb-trunk-r351319/; revision=343182; tag=vendor/lldb/lldb-trunk-r351319
Diffstat (limited to 'source/Interpreter')
-rw-r--r--source/Interpreter/CMakeLists.txt4
-rw-r--r--source/Interpreter/CommandAlias.cpp3
-rw-r--r--source/Interpreter/CommandInterpreter.cpp484
-rw-r--r--source/Interpreter/CommandObject.cpp15
-rw-r--r--source/Interpreter/CommandObjectRegexCommand.cpp4
-rw-r--r--source/Interpreter/CommandObjectScript.cpp4
-rw-r--r--source/Interpreter/CommandObjectScript.h4
-rw-r--r--source/Interpreter/CommandReturnObject.cpp4
-rw-r--r--source/Interpreter/OptionArgParser.cpp16
-rw-r--r--source/Interpreter/OptionGroupArchitecture.cpp4
-rw-r--r--source/Interpreter/OptionGroupBoolean.cpp6
-rw-r--r--source/Interpreter/OptionGroupFile.cpp8
-rw-r--r--source/Interpreter/OptionGroupFormat.cpp10
-rw-r--r--source/Interpreter/OptionGroupOutputFile.cpp10
-rw-r--r--source/Interpreter/OptionGroupPlatform.cpp22
-rw-r--r--source/Interpreter/OptionGroupString.cpp6
-rw-r--r--source/Interpreter/OptionGroupUInt64.cpp6
-rw-r--r--source/Interpreter/OptionGroupUUID.cpp8
-rw-r--r--source/Interpreter/OptionGroupValueObjectDisplay.cpp44
-rw-r--r--source/Interpreter/OptionGroupVariable.cpp33
-rw-r--r--source/Interpreter/OptionGroupWatchpoint.cpp26
-rw-r--r--source/Interpreter/OptionValue.cpp4
-rw-r--r--source/Interpreter/OptionValueArch.cpp6
-rw-r--r--source/Interpreter/OptionValueArgs.cpp4
-rw-r--r--source/Interpreter/OptionValueArray.cpp32
-rw-r--r--source/Interpreter/OptionValueBoolean.cpp4
-rw-r--r--source/Interpreter/OptionValueChar.cpp4
-rw-r--r--source/Interpreter/OptionValueDictionary.cpp20
-rw-r--r--source/Interpreter/OptionValueEnumeration.cpp24
-rw-r--r--source/Interpreter/OptionValueFileSpec.cpp12
-rw-r--r--source/Interpreter/OptionValueFileSpecLIst.cpp32
-rw-r--r--source/Interpreter/OptionValueFormat.cpp4
-rw-r--r--source/Interpreter/OptionValueFormatEntity.cpp24
-rw-r--r--source/Interpreter/OptionValueLanguage.cpp7
-rw-r--r--source/Interpreter/OptionValuePathMappings.cpp9
-rw-r--r--source/Interpreter/OptionValueProperties.cpp14
-rw-r--r--source/Interpreter/OptionValueRegex.cpp4
-rw-r--r--source/Interpreter/OptionValueSInt64.cpp4
-rw-r--r--source/Interpreter/OptionValueString.cpp4
-rw-r--r--source/Interpreter/OptionValueUInt64.cpp4
-rw-r--r--source/Interpreter/OptionValueUUID.cpp4
-rw-r--r--source/Interpreter/Options.cpp39
-rw-r--r--source/Interpreter/Property.cpp13
43 files changed, 508 insertions, 485 deletions
diff --git a/source/Interpreter/CMakeLists.txt b/source/Interpreter/CMakeLists.txt
index aaa335af39f9..f8fed8b4ac14 100644
--- a/source/Interpreter/CMakeLists.txt
+++ b/source/Interpreter/CMakeLists.txt
@@ -55,3 +55,7 @@ add_lldb_library(lldbInterpreter
LINK_COMPONENTS
Support
)
+
+if (NOT LLDB_DISABLE_LIBEDIT)
+ target_include_directories(lldbInterpreter PRIVATE ${libedit_INCLUDE_DIRS})
+endif() \ No newline at end of file
diff --git a/source/Interpreter/CommandAlias.cpp b/source/Interpreter/CommandAlias.cpp
index a4b0a0c55c0e..078eb73a7a87 100644
--- a/source/Interpreter/CommandAlias.cpp
+++ b/source/Interpreter/CommandAlias.cpp
@@ -158,8 +158,7 @@ void CommandAlias::GetAliasExpansion(StreamString &help_string) const {
help_string.Printf(" %s", value.c_str());
} else {
help_string.Printf(" %s", opt.c_str());
- if ((value.compare("<no-argument>") != 0) &&
- (value.compare("<need-argument") != 0)) {
+ if ((value != "<no-argument>") && (value != "<need-argument")) {
help_string.Printf(" %s", value.c_str());
}
}
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 64d2c3222fb6..6d75ec57c83b 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -31,6 +31,7 @@
#include "Commands/CommandObjectProcess.h"
#include "Commands/CommandObjectQuit.h"
#include "Commands/CommandObjectRegister.h"
+#include "Commands/CommandObjectReproducer.h"
#include "Commands/CommandObjectSettings.h"
#include "Commands/CommandObjectSource.h"
#include "Commands/CommandObjectStats.h"
@@ -42,9 +43,9 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/Timer.h"
@@ -76,28 +77,43 @@ using namespace lldb_private;
static const char *k_white_space = " \t\v";
-static PropertyDefinition g_properties[] = {
- {"expand-regex-aliases", OptionValue::eTypeBoolean, true, false, nullptr,
- nullptr, "If true, regular expression alias commands will show the "
- "expanded command that will be executed. This can be used to "
- "debug new regular expression alias commands."},
- {"prompt-on-quit", OptionValue::eTypeBoolean, true, true, nullptr, nullptr,
+static constexpr bool NoGlobalSetting = true;
+static constexpr uintptr_t DefaultValueTrue = true;
+static constexpr uintptr_t DefaultValueFalse = false;
+static constexpr const char *NoCStrDefault = nullptr;
+
+static constexpr PropertyDefinition g_properties[] = {
+ {"expand-regex-aliases", OptionValue::eTypeBoolean, NoGlobalSetting,
+ DefaultValueFalse, NoCStrDefault, {},
+ "If true, regular expression alias commands will show the "
+ "expanded command that will be executed. This can be used to "
+ "debug new regular expression alias commands."},
+ {"prompt-on-quit", OptionValue::eTypeBoolean, NoGlobalSetting,
+ DefaultValueTrue, NoCStrDefault, {},
"If true, LLDB will prompt you before quitting if there are any live "
"processes being debugged. If false, LLDB will quit without asking in any "
"case."},
- {"stop-command-source-on-error", OptionValue::eTypeBoolean, true, true,
- nullptr, nullptr, "If true, LLDB will stop running a 'command source' "
- "script upon encountering an error."},
- {"space-repl-prompts", OptionValue::eTypeBoolean, true, false, nullptr,
- nullptr,
+ {"stop-command-source-on-error", OptionValue::eTypeBoolean, NoGlobalSetting,
+ DefaultValueTrue, NoCStrDefault, {},
+ "If true, LLDB will stop running a 'command source' "
+ "script upon encountering an error."},
+ {"space-repl-prompts", OptionValue::eTypeBoolean, NoGlobalSetting,
+ DefaultValueFalse, NoCStrDefault, {},
"If true, blank lines will be printed between between REPL submissions."},
- {nullptr, OptionValue::eTypeInvalid, true, 0, nullptr, nullptr, nullptr}};
+ {"echo-commands", OptionValue::eTypeBoolean, NoGlobalSetting,
+ DefaultValueTrue, NoCStrDefault, {},
+ "If true, commands will be echoed before they are evaluated."},
+ {"echo-comment-commands", OptionValue::eTypeBoolean, NoGlobalSetting,
+ DefaultValueTrue, NoCStrDefault, {},
+ "If true, commands will be echoed even if they are pure comment lines."}};
enum {
ePropertyExpandRegexAliases = 0,
ePropertyPromptOnQuit = 1,
ePropertyStopCmdSourceOnError = 2,
- eSpaceReplPrompts = 3
+ eSpaceReplPrompts = 3,
+ eEchoCommands = 4,
+ eEchoCommentCommands = 5
};
ConstString &CommandInterpreter::GetStaticBroadcasterClass() {
@@ -144,6 +160,28 @@ void CommandInterpreter::SetPromptOnQuit(bool b) {
m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
}
+bool CommandInterpreter::GetEchoCommands() const {
+ const uint32_t idx = eEchoCommands;
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(
+ nullptr, idx, g_properties[idx].default_uint_value != 0);
+}
+
+void CommandInterpreter::SetEchoCommands(bool b) {
+ const uint32_t idx = eEchoCommands;
+ m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
+bool CommandInterpreter::GetEchoCommentCommands() const {
+ const uint32_t idx = eEchoCommentCommands;
+ return m_collection_sp->GetPropertyAtIndexAsBoolean(
+ nullptr, idx, g_properties[idx].default_uint_value != 0);
+}
+
+void CommandInterpreter::SetEchoCommentCommands(bool b) {
+ const uint32_t idx = eEchoCommentCommands;
+ m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
+}
+
void CommandInterpreter::AllowExitCodeOnQuit(bool allow) {
m_allow_exit_code = allow;
if (!allow)
@@ -386,6 +424,13 @@ void CommandInterpreter::Initialize() {
if (cmd_obj_sp) {
AddAlias("rbreak", cmd_obj_sp, "--func-regex %1");
}
+
+ cmd_obj_sp = GetCommandSPExact("frame variable", false);
+ if (cmd_obj_sp) {
+ AddAlias("v", cmd_obj_sp);
+ AddAlias("var", cmd_obj_sp);
+ AddAlias("vo", cmd_obj_sp, "--object-description");
+ }
}
void CommandInterpreter::Clear() {
@@ -439,6 +484,8 @@ void CommandInterpreter::LoadCommandDictionary() {
m_command_dict["quit"] = CommandObjectSP(new CommandObjectQuit(*this));
m_command_dict["register"] =
CommandObjectSP(new CommandObjectRegister(*this));
+ m_command_dict["reproducer"] =
+ CommandObjectSP(new CommandObjectReproducer(*this));
m_command_dict["script"] =
CommandObjectSP(new CommandObjectScript(*this, script_language));
m_command_dict["settings"] =
@@ -794,20 +841,23 @@ void CommandInterpreter::LoadCommandDictionary() {
}
int CommandInterpreter::GetCommandNamesMatchingPartialString(
- const char *cmd_str, bool include_aliases, StringList &matches) {
- AddNamesMatchingPartialString(m_command_dict, cmd_str, matches);
+ const char *cmd_str, bool include_aliases, StringList &matches,
+ StringList &descriptions) {
+ AddNamesMatchingPartialString(m_command_dict, cmd_str, matches,
+ &descriptions);
if (include_aliases) {
- AddNamesMatchingPartialString(m_alias_dict, cmd_str, matches);
+ AddNamesMatchingPartialString(m_alias_dict, cmd_str, matches,
+ &descriptions);
}
return matches.GetSize();
}
-CommandObjectSP CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str,
- bool include_aliases,
- bool exact,
- StringList *matches) const {
+CommandObjectSP
+CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str, bool include_aliases,
+ bool exact, StringList *matches,
+ StringList *descriptions) const {
CommandObjectSP command_sp;
std::string cmd = cmd_str;
@@ -848,8 +898,8 @@ CommandObjectSP CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str,
// empty CommandObjectSP and the list of matches.
if (HasCommands()) {
- num_cmd_matches =
- AddNamesMatchingPartialString(m_command_dict, cmd_str, *matches);
+ num_cmd_matches = AddNamesMatchingPartialString(m_command_dict, cmd_str,
+ *matches, descriptions);
}
if (num_cmd_matches == 1) {
@@ -860,8 +910,8 @@ CommandObjectSP CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str,
}
if (include_aliases && HasAliases()) {
- num_alias_matches =
- AddNamesMatchingPartialString(m_alias_dict, cmd_str, *matches);
+ num_alias_matches = AddNamesMatchingPartialString(m_alias_dict, cmd_str,
+ *matches, descriptions);
}
if (num_alias_matches == 1) {
@@ -872,8 +922,8 @@ CommandObjectSP CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str,
}
if (HasUserCommands()) {
- num_user_matches =
- AddNamesMatchingPartialString(m_user_dict, cmd_str, *matches);
+ num_user_matches = AddNamesMatchingPartialString(m_user_dict, cmd_str,
+ *matches, descriptions);
}
if (num_user_matches == 1) {
@@ -898,6 +948,8 @@ CommandObjectSP CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str,
}
} else if (matches && command_sp) {
matches->AppendString(cmd_str);
+ if (descriptions)
+ descriptions->AppendString(command_sp->GetHelp());
}
return command_sp;
@@ -935,16 +987,16 @@ bool CommandInterpreter::AddUserCommand(llvm::StringRef name,
if (!name.empty()) {
// do not allow replacement of internal commands
if (CommandExists(name)) {
- if (can_replace == false)
+ if (!can_replace)
return false;
- if (m_command_dict[name]->IsRemovable() == false)
+ if (!m_command_dict[name]->IsRemovable())
return false;
}
if (UserCommandExists(name)) {
- if (can_replace == false)
+ if (!can_replace)
return false;
- if (m_user_dict[name]->IsRemovable() == false)
+ if (!m_user_dict[name]->IsRemovable())
return false;
}
@@ -997,10 +1049,12 @@ CommandObjectSP CommandInterpreter::GetCommandSPExact(llvm::StringRef cmd_str,
return ret_val;
}
-CommandObject *CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str,
- StringList *matches) const {
+CommandObject *
+CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str,
+ StringList *matches,
+ StringList *descriptions) const {
CommandObject *command_obj =
- GetCommandSP(cmd_str, false, true, matches).get();
+ GetCommandSP(cmd_str, false, true, matches, descriptions).get();
// If we didn't find an exact match to the command string in the commands,
// look in the aliases.
@@ -1008,7 +1062,7 @@ CommandObject *CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str,
if (command_obj)
return command_obj;
- command_obj = GetCommandSP(cmd_str, true, true, matches).get();
+ command_obj = GetCommandSP(cmd_str, true, true, matches, descriptions).get();
if (command_obj)
return command_obj;
@@ -1023,10 +1077,12 @@ CommandObject *CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str,
if (command_obj) {
if (matches)
matches->AppendString(command_obj->GetCommandName());
+ if (descriptions)
+ descriptions->AppendString(command_obj->GetHelp());
return command_obj;
}
- return GetCommandSP(cmd_str, true, false, matches).get();
+ return GetCommandSP(cmd_str, true, false, matches, descriptions).get();
}
bool CommandInterpreter::CommandExists(llvm::StringRef cmd) const {
@@ -1337,7 +1393,7 @@ CommandObject *CommandInterpreter::BuildAliasResult(
alias_cmd_obj = desugared.first.get();
std::string alias_name_str = alias_name;
if ((cmd_args.GetArgumentCount() == 0) ||
- (alias_name_str.compare(cmd_args.GetArgumentAtIndex(0)) != 0))
+ (alias_name_str != cmd_args.GetArgumentAtIndex(0)))
cmd_args.Unshift(alias_name_str);
result_str.Printf("%s", alias_cmd_obj->GetCommandName().str().c_str());
@@ -1399,130 +1455,140 @@ Status CommandInterpreter::PreprocessCommand(std::string &command) {
size_t start_backtick;
size_t pos = 0;
while ((start_backtick = command.find('`', pos)) != std::string::npos) {
+ // Stop if an error was encountered during the previous iteration.
+ if (error.Fail())
+ break;
+
if (start_backtick > 0 && command[start_backtick - 1] == '\\') {
// The backtick was preceded by a '\' character, remove the slash and
- // don't treat the backtick as the start of an expression
+ // don't treat the backtick as the start of an expression.
command.erase(start_backtick - 1, 1);
- // No need to add one to start_backtick since we just deleted a char
+ // No need to add one to start_backtick since we just deleted a char.
pos = start_backtick;
- } else {
- const size_t expr_content_start = start_backtick + 1;
- const size_t end_backtick = command.find('`', expr_content_start);
- if (end_backtick == std::string::npos)
- return error;
- else if (end_backtick == expr_content_start) {
- // Empty expression (two backticks in a row)
- command.erase(start_backtick, 2);
- } else {
- std::string expr_str(command, expr_content_start,
- end_backtick - expr_content_start);
-
- ExecutionContext exe_ctx(GetExecutionContext());
- Target *target = exe_ctx.GetTargetPtr();
- // Get a dummy target to allow for calculator mode while processing
- // backticks. This also helps break the infinite loop caused when
- // target is null.
- if (!target)
- target = m_debugger.GetDummyTarget();
- if (target) {
- ValueObjectSP expr_result_valobj_sp;
-
- EvaluateExpressionOptions options;
- options.SetCoerceToId(false);
- options.SetUnwindOnError(true);
- options.SetIgnoreBreakpoints(true);
- options.SetKeepInMemory(false);
- options.SetTryAllThreads(true);
- options.SetTimeout(llvm::None);
-
- ExpressionResults expr_result = target->EvaluateExpression(
- expr_str.c_str(), exe_ctx.GetFramePtr(), expr_result_valobj_sp,
- options);
-
- if (expr_result == eExpressionCompleted) {
- Scalar scalar;
- if (expr_result_valobj_sp)
- expr_result_valobj_sp =
- expr_result_valobj_sp->GetQualifiedRepresentationIfAvailable(
- expr_result_valobj_sp->GetDynamicValueType(), true);
- if (expr_result_valobj_sp->ResolveValue(scalar)) {
- command.erase(start_backtick, end_backtick - start_backtick + 1);
- StreamString value_strm;
- const bool show_type = false;
- scalar.GetValue(&value_strm, show_type);
- size_t value_string_size = value_strm.GetSize();
- if (value_string_size) {
- command.insert(start_backtick, value_strm.GetString());
- pos = start_backtick + value_string_size;
- continue;
- } else {
- error.SetErrorStringWithFormat("expression value didn't result "
- "in a scalar value for the "
- "expression '%s'",
- expr_str.c_str());
- }
- } else {
- error.SetErrorStringWithFormat("expression value didn't result "
- "in a scalar value for the "
- "expression '%s'",
- expr_str.c_str());
- }
- } else {
- if (expr_result_valobj_sp)
- error = expr_result_valobj_sp->GetError();
- if (error.Success()) {
-
- switch (expr_result) {
- case eExpressionSetupError:
- error.SetErrorStringWithFormat(
- "expression setup error for the expression '%s'",
- expr_str.c_str());
- break;
- case eExpressionParseError:
- error.SetErrorStringWithFormat(
- "expression parse error for the expression '%s'",
- expr_str.c_str());
- break;
- case eExpressionResultUnavailable:
- error.SetErrorStringWithFormat(
- "expression error fetching result for the expression '%s'",
- expr_str.c_str());
- break;
- case eExpressionCompleted:
- break;
- case eExpressionDiscarded:
- error.SetErrorStringWithFormat(
- "expression discarded for the expression '%s'",
- expr_str.c_str());
- break;
- case eExpressionInterrupted:
- error.SetErrorStringWithFormat(
- "expression interrupted for the expression '%s'",
- expr_str.c_str());
- break;
- case eExpressionHitBreakpoint:
- error.SetErrorStringWithFormat(
- "expression hit breakpoint for the expression '%s'",
- expr_str.c_str());
- break;
- case eExpressionTimedOut:
- error.SetErrorStringWithFormat(
- "expression timed out for the expression '%s'",
- expr_str.c_str());
- break;
- case eExpressionStoppedForDebug:
- error.SetErrorStringWithFormat("expression stop at entry point "
- "for debugging for the "
- "expression '%s'",
- expr_str.c_str());
- break;
- }
- }
- }
+ continue;
+ }
+
+ const size_t expr_content_start = start_backtick + 1;
+ const size_t end_backtick = command.find('`', expr_content_start);
+
+ if (end_backtick == std::string::npos) {
+ // Stop if there's no end backtick.
+ break;
+ }
+
+ if (end_backtick == expr_content_start) {
+ // Skip over empty expression. (two backticks in a row)
+ command.erase(start_backtick, 2);
+ continue;
+ }
+
+ std::string expr_str(command, expr_content_start,
+ end_backtick - expr_content_start);
+
+ ExecutionContext exe_ctx(GetExecutionContext());
+ Target *target = exe_ctx.GetTargetPtr();
+
+ // Get a dummy target to allow for calculator mode while processing
+ // backticks. This also helps break the infinite loop caused when target is
+ // null.
+ if (!target)
+ target = m_debugger.GetDummyTarget();
+
+ if (!target)
+ continue;
+
+ ValueObjectSP expr_result_valobj_sp;
+
+ EvaluateExpressionOptions options;
+ options.SetCoerceToId(false);
+ options.SetUnwindOnError(true);
+ options.SetIgnoreBreakpoints(true);
+ options.SetKeepInMemory(false);
+ options.SetTryAllThreads(true);
+ options.SetTimeout(llvm::None);
+
+ ExpressionResults expr_result =
+ target->EvaluateExpression(expr_str.c_str(), exe_ctx.GetFramePtr(),
+ expr_result_valobj_sp, options);
+
+ if (expr_result == eExpressionCompleted) {
+ Scalar scalar;
+ if (expr_result_valobj_sp)
+ expr_result_valobj_sp =
+ expr_result_valobj_sp->GetQualifiedRepresentationIfAvailable(
+ expr_result_valobj_sp->GetDynamicValueType(), true);
+ if (expr_result_valobj_sp->ResolveValue(scalar)) {
+ command.erase(start_backtick, end_backtick - start_backtick + 1);
+ StreamString value_strm;
+ const bool show_type = false;
+ scalar.GetValue(&value_strm, show_type);
+ size_t value_string_size = value_strm.GetSize();
+ if (value_string_size) {
+ command.insert(start_backtick, value_strm.GetString());
+ pos = start_backtick + value_string_size;
+ continue;
+ } else {
+ error.SetErrorStringWithFormat("expression value didn't result "
+ "in a scalar value for the "
+ "expression '%s'",
+ expr_str.c_str());
+ break;
}
+ } else {
+ error.SetErrorStringWithFormat("expression value didn't result "
+ "in a scalar value for the "
+ "expression '%s'",
+ expr_str.c_str());
+ break;
}
- if (error.Fail())
+
+ continue;
+ }
+
+ if (expr_result_valobj_sp)
+ error = expr_result_valobj_sp->GetError();
+
+ if (error.Success()) {
+ switch (expr_result) {
+ case eExpressionSetupError:
+ error.SetErrorStringWithFormat(
+ "expression setup error for the expression '%s'", expr_str.c_str());
+ break;
+ case eExpressionParseError:
+ error.SetErrorStringWithFormat(
+ "expression parse error for the expression '%s'", expr_str.c_str());
+ break;
+ case eExpressionResultUnavailable:
+ error.SetErrorStringWithFormat(
+ "expression error fetching result for the expression '%s'",
+ expr_str.c_str());
+ break;
+ case eExpressionCompleted:
+ break;
+ case eExpressionDiscarded:
+ error.SetErrorStringWithFormat(
+ "expression discarded for the expression '%s'", expr_str.c_str());
+ break;
+ case eExpressionInterrupted:
+ error.SetErrorStringWithFormat(
+ "expression interrupted for the expression '%s'", expr_str.c_str());
+ break;
+ case eExpressionHitBreakpoint:
+ error.SetErrorStringWithFormat(
+ "expression hit breakpoint for the expression '%s'",
+ expr_str.c_str());
break;
+ case eExpressionTimedOut:
+ error.SetErrorStringWithFormat(
+ "expression timed out for the expression '%s'", expr_str.c_str());
+ break;
+ case eExpressionStoppedForDebug:
+ error.SetErrorStringWithFormat("expression stop at entry point "
+ "for debugging for the "
+ "expression '%s'",
+ expr_str.c_str());
+ break;
+ }
}
}
return error;
@@ -1712,16 +1778,17 @@ int CommandInterpreter::HandleCompletionMatches(CompletionRequest &request) {
if (request.GetCursorIndex() == -1) {
// We got nothing on the command line, so return the list of commands
bool include_aliases = true;
- StringList new_matches;
- num_command_matches =
- GetCommandNamesMatchingPartialString("", include_aliases, new_matches);
- request.AddCompletions(new_matches);
+ StringList new_matches, descriptions;
+ num_command_matches = GetCommandNamesMatchingPartialString(
+ "", include_aliases, new_matches, descriptions);
+ request.AddCompletions(new_matches, descriptions);
} else if (request.GetCursorIndex() == 0) {
// The cursor is in the first argument, so just do a lookup in the
// dictionary.
- StringList new_matches;
- CommandObject *cmd_obj = GetCommandObject(
- request.GetParsedLine().GetArgumentAtIndex(0), &new_matches);
+ StringList new_matches, new_descriptions;
+ CommandObject *cmd_obj =
+ GetCommandObject(request.GetParsedLine().GetArgumentAtIndex(0),
+ &new_matches, &new_descriptions);
if (num_command_matches == 1 && cmd_obj && cmd_obj->IsMultiwordObject() &&
new_matches.GetStringAtIndex(0) != nullptr &&
@@ -1733,12 +1800,13 @@ int CommandInterpreter::HandleCompletionMatches(CompletionRequest &request) {
look_for_subcommand = true;
num_command_matches = 0;
new_matches.DeleteStringAtIndex(0);
+ new_descriptions.DeleteStringAtIndex(0);
request.GetParsedLine().AppendArgument(llvm::StringRef());
request.SetCursorIndex(request.GetCursorIndex() + 1);
request.SetCursorCharPosition(0);
}
}
- request.AddCompletions(new_matches);
+ request.AddCompletions(new_matches, new_descriptions);
num_command_matches = request.GetNumberOfMatches();
}
@@ -1762,12 +1830,13 @@ int CommandInterpreter::HandleCompletionMatches(CompletionRequest &request) {
int CommandInterpreter::HandleCompletion(
const char *current_line, const char *cursor, const char *last_char,
- int match_start_point, int max_return_elements, StringList &matches) {
+ int match_start_point, int max_return_elements, StringList &matches,
+ StringList &descriptions) {
llvm::StringRef command_line(current_line, last_char - current_line);
+ CompletionResult result;
CompletionRequest request(command_line, cursor - current_line,
- match_start_point, max_return_elements, matches);
-
+ match_start_point, max_return_elements, result);
// Don't complete comments, and if the line we are completing is just the
// history repeat character, substitute the appropriate history line.
const char *first_arg = request.GetParsedLine().GetArgumentAtIndex(0);
@@ -1777,6 +1846,7 @@ int CommandInterpreter::HandleCompletion(
else if (first_arg[0] == CommandHistory::g_repeat_char) {
if (auto hist_str = m_command_history.FindString(first_arg)) {
matches.InsertStringAtIndex(0, *hist_str);
+ descriptions.InsertStringAtIndex(0, "Previous command history event");
return -2;
} else
return 0;
@@ -1787,6 +1857,8 @@ int CommandInterpreter::HandleCompletion(
lldbassert(max_return_elements == -1);
int num_command_matches = HandleCompletionMatches(request);
+ result.GetMatches(matches);
+ result.GetDescriptions(descriptions);
if (num_command_matches <= 0)
return num_command_matches;
@@ -1794,6 +1866,7 @@ int CommandInterpreter::HandleCompletion(
if (request.GetParsedLine().GetArgumentCount() == 0) {
// If we got an empty string, insert nothing.
matches.InsertStringAtIndex(0, "");
+ descriptions.InsertStringAtIndex(0, "");
} else {
// Now figure out if there is a common substring, and if so put that in
// element 0, otherwise put an empty string in element 0.
@@ -1815,6 +1888,7 @@ int CommandInterpreter::HandleCompletion(
common_prefix.push_back(' ');
}
matches.InsertStringAtIndex(0, common_prefix.c_str());
+ descriptions.InsertStringAtIndex(0, "");
}
return num_command_matches;
}
@@ -1873,7 +1947,7 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj,
// Make sure that the alias name is the 0th element in cmd_args
std::string alias_name_str = alias_name;
- if (alias_name_str.compare(cmd_args.GetArgumentAtIndex(0)) != 0)
+ if (alias_name_str != cmd_args.GetArgumentAtIndex(0))
cmd_args.Unshift(alias_name_str);
Args new_args(alias_cmd_obj->GetCommandName());
@@ -2025,13 +2099,14 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
LoadCWDlldbinitFile should_load =
target->TargetProperties::GetLoadCWDlldbinitFile();
if (should_load == eLoadCWDlldbinitWarn) {
- FileSpec dot_lldb(".lldbinit", true);
+ FileSpec dot_lldb(".lldbinit");
+ FileSystem::Instance().Resolve(dot_lldb);
llvm::SmallString<64> home_dir_path;
llvm::sys::path::home_directory(home_dir_path);
- FileSpec homedir_dot_lldb(home_dir_path.c_str(), false);
+ FileSpec homedir_dot_lldb(home_dir_path.c_str());
homedir_dot_lldb.AppendPathComponent(".lldbinit");
- homedir_dot_lldb.ResolvePath();
- if (dot_lldb.Exists() &&
+ FileSystem::Instance().Resolve(homedir_dot_lldb);
+ if (FileSystem::Instance().Exists(dot_lldb) &&
dot_lldb.GetDirectory() != homedir_dot_lldb.GetDirectory()) {
result.AppendErrorWithFormat(
"There is a .lldbinit file in the current directory which is not "
@@ -2049,7 +2124,8 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
return;
}
} else if (should_load == eLoadCWDlldbinitTrue) {
- init_file.SetFile("./.lldbinit", true, FileSpec::Style::native);
+ init_file.SetFile("./.lldbinit", FileSpec::Style::native);
+ FileSystem::Instance().Resolve(init_file);
}
}
} else {
@@ -2061,11 +2137,11 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
// init files.
llvm::SmallString<64> home_dir_path;
llvm::sys::path::home_directory(home_dir_path);
- FileSpec profilePath(home_dir_path.c_str(), false);
+ FileSpec profilePath(home_dir_path.c_str());
profilePath.AppendPathComponent(".lldbinit");
std::string init_file_path = profilePath.GetPath();
- if (m_skip_app_init_files == false) {
+ if (!m_skip_app_init_files) {
FileSpec program_file_spec(HostInfo::GetProgramFileSpec());
const char *program_name = program_file_spec.GetFilename().AsCString();
@@ -2073,22 +2149,22 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
char program_init_file_name[PATH_MAX];
::snprintf(program_init_file_name, sizeof(program_init_file_name),
"%s-%s", init_file_path.c_str(), program_name);
- init_file.SetFile(program_init_file_name, true,
- FileSpec::Style::native);
- if (!init_file.Exists())
+ init_file.SetFile(program_init_file_name, FileSpec::Style::native);
+ FileSystem::Instance().Resolve(init_file);
+ if (!FileSystem::Instance().Exists(init_file))
init_file.Clear();
}
}
if (!init_file && !m_skip_lldbinit_files)
- init_file.SetFile(init_file_path, false, FileSpec::Style::native);
+ init_file.SetFile(init_file_path, FileSpec::Style::native);
}
// If the file exists, tell HandleCommand to 'source' it; this will do the
// actual broadcasting of the commands back to any appropriate listener (see
// CommandObjectSource::Execute for more details).
- if (init_file.Exists()) {
+ if (FileSystem::Instance().Exists(init_file)) {
const bool saved_batch = SetBatchCommandMode(true);
CommandInterpreterRunOptions options;
options.SetSilent(true);
@@ -2281,20 +2357,20 @@ enum {
eHandleCommandFlagStopOnContinue = (1u << 0),
eHandleCommandFlagStopOnError = (1u << 1),
eHandleCommandFlagEchoCommand = (1u << 2),
- eHandleCommandFlagPrintResult = (1u << 3),
- eHandleCommandFlagStopOnCrash = (1u << 4)
+ eHandleCommandFlagEchoCommentCommand = (1u << 3),
+ eHandleCommandFlagPrintResult = (1u << 4),
+ eHandleCommandFlagStopOnCrash = (1u << 5)
};
void CommandInterpreter::HandleCommandsFromFile(
FileSpec &cmd_file, ExecutionContext *context,
CommandInterpreterRunOptions &options, CommandReturnObject &result) {
- if (cmd_file.Exists()) {
+ if (FileSystem::Instance().Exists(cmd_file)) {
StreamFileSP input_file_sp(new StreamFile());
std::string cmd_file_path = cmd_file.GetPath();
- Status error = input_file_sp->GetFile().Open(cmd_file_path.c_str(),
- File::eOpenOptionRead);
-
+ Status error = FileSystem::Instance().Open(input_file_sp->GetFile(),
+ cmd_file, File::eOpenOptionRead);
if (error.Success()) {
Debugger &debugger = GetDebugger();
@@ -2324,9 +2400,10 @@ void CommandInterpreter::HandleCommandsFromFile(
flags |= eHandleCommandFlagStopOnError;
}
+ // stop-on-crash can only be set, if it is present in all levels of
+ // pushed flag sets.
if (options.GetStopOnCrash()) {
if (m_command_source_flags.empty()) {
- // Echo command by default
flags |= eHandleCommandFlagStopOnCrash;
} else if (m_command_source_flags.back() &
eHandleCommandFlagStopOnCrash) {
@@ -2346,6 +2423,19 @@ void CommandInterpreter::HandleCommandsFromFile(
flags |= eHandleCommandFlagEchoCommand;
}
+ // We will only ever ask for this flag, if we echo commands in general.
+ if (options.m_echo_comment_commands == eLazyBoolCalculate) {
+ if (m_command_source_flags.empty()) {
+ // Echo comments by default
+ flags |= eHandleCommandFlagEchoCommentCommand;
+ } else if (m_command_source_flags.back() &
+ eHandleCommandFlagEchoCommentCommand) {
+ flags |= eHandleCommandFlagEchoCommentCommand;
+ }
+ } else if (options.m_echo_comment_commands == eLazyBoolYes) {
+ flags |= eHandleCommandFlagEchoCommentCommand;
+ }
+
if (options.m_print_results == eLazyBoolCalculate) {
if (m_command_source_flags.empty()) {
// Print output by default
@@ -2667,6 +2757,21 @@ void CommandInterpreter::PrintCommandOutput(Stream &stream,
}
}
+bool CommandInterpreter::EchoCommandNonInteractive(
+ llvm::StringRef line, const Flags &io_handler_flags) const {
+ if (!io_handler_flags.Test(eHandleCommandFlagEchoCommand))
+ return false;
+
+ llvm::StringRef command = line.trim();
+ if (command.empty())
+ return true;
+
+ if (command.front() == m_comment_char)
+ return io_handler_flags.Test(eHandleCommandFlagEchoCommentCommand);
+
+ return true;
+}
+
void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
std::string &line) {
// If we were interrupted, bail out...
@@ -2674,7 +2779,7 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
return;
const bool is_interactive = io_handler.GetIsInteractive();
- if (is_interactive == false) {
+ if (!is_interactive) {
// When we are not interactive, don't execute blank lines. This will happen
// sourcing a commands file. We don't want blank lines to repeat the
// previous command and cause any errors to occur (like redefining an
@@ -2685,7 +2790,7 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
// When using a non-interactive file handle (like when sourcing commands
// from a file) we need to echo the command out so we don't just see the
// command output and no command...
- if (io_handler.GetFlags().Test(eHandleCommandFlagEchoCommand))
+ if (EchoCommandNonInteractive(line, io_handler.GetFlags()))
io_handler.GetOutputStreamFile()->Printf("%s%s\n", io_handler.GetPrompt(),
line.c_str());
}
@@ -2859,6 +2964,8 @@ CommandInterpreter::GetIOHandler(bool force_create,
flags |= eHandleCommandFlagStopOnCrash;
if (options->m_echo_commands != eLazyBoolNo)
flags |= eHandleCommandFlagEchoCommand;
+ if (options->m_echo_comment_commands != eLazyBoolNo)
+ flags |= eHandleCommandFlagEchoCommentCommand;
if (options->m_print_results != eLazyBoolNo)
flags |= eHandleCommandFlagPrintResult;
} else {
@@ -2921,8 +3028,7 @@ CommandInterpreter::ResolveCommandImpl(std::string &command_line,
bool is_alias = GetAliasFullName(next_word, full_name);
cmd_obj = GetCommandObject(next_word, &matches);
bool is_real_command =
- (is_alias == false) ||
- (cmd_obj != nullptr && cmd_obj->IsAlias() == false);
+ (!is_alias) || (cmd_obj != nullptr && !cmd_obj->IsAlias());
if (!is_real_command) {
matches.Clear();
std::string alias_result;
diff --git a/source/Interpreter/CommandObject.cpp b/source/Interpreter/CommandObject.cpp
index 324b0b511220..05c540b37c62 100644
--- a/source/Interpreter/CommandObject.cpp
+++ b/source/Interpreter/CommandObject.cpp
@@ -409,15 +409,12 @@ const char *CommandObject::GetArgumentName(CommandArgumentType arg_type) {
}
bool CommandObject::IsPairType(ArgumentRepetitionType arg_repeat_type) {
- if ((arg_repeat_type == eArgRepeatPairPlain) ||
- (arg_repeat_type == eArgRepeatPairOptional) ||
- (arg_repeat_type == eArgRepeatPairPlus) ||
- (arg_repeat_type == eArgRepeatPairStar) ||
- (arg_repeat_type == eArgRepeatPairRange) ||
- (arg_repeat_type == eArgRepeatPairRangeOptional))
- return true;
-
- return false;
+ return (arg_repeat_type == eArgRepeatPairPlain) ||
+ (arg_repeat_type == eArgRepeatPairOptional) ||
+ (arg_repeat_type == eArgRepeatPairPlus) ||
+ (arg_repeat_type == eArgRepeatPairStar) ||
+ (arg_repeat_type == eArgRepeatPairRange) ||
+ (arg_repeat_type == eArgRepeatPairRangeOptional);
}
static CommandObject::CommandArgumentEntry
diff --git a/source/Interpreter/CommandObjectRegexCommand.cpp b/source/Interpreter/CommandObjectRegexCommand.cpp
index ec89ad8fb162..2944177b0dc3 100644
--- a/source/Interpreter/CommandObjectRegexCommand.cpp
+++ b/source/Interpreter/CommandObjectRegexCommand.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/CommandObjectRegexCommand.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
diff --git a/source/Interpreter/CommandObjectScript.cpp b/source/Interpreter/CommandObjectScript.cpp
index fa1516df60c9..ed434031ae4e 100644
--- a/source/Interpreter/CommandObjectScript.cpp
+++ b/source/Interpreter/CommandObjectScript.cpp
@@ -9,10 +9,6 @@
#include "CommandObjectScript.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Core/Debugger.h"
diff --git a/source/Interpreter/CommandObjectScript.h b/source/Interpreter/CommandObjectScript.h
index 7a61b06e5b04..ca453a875494 100644
--- a/source/Interpreter/CommandObjectScript.h
+++ b/source/Interpreter/CommandObjectScript.h
@@ -10,10 +10,6 @@
#ifndef liblldb_CommandObjectScript_h_
#define liblldb_CommandObjectScript_h_
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Interpreter/CommandObject.h"
namespace lldb_private {
diff --git a/source/Interpreter/CommandReturnObject.cpp b/source/Interpreter/CommandReturnObject.cpp
index 7c06e22c3909..cf397a47a3bf 100644
--- a/source/Interpreter/CommandReturnObject.cpp
+++ b/source/Interpreter/CommandReturnObject.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/CommandReturnObject.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
diff --git a/source/Interpreter/OptionArgParser.cpp b/source/Interpreter/OptionArgParser.cpp
index 3bd3af8fc50e..b0565b706c5b 100644
--- a/source/Interpreter/OptionArgParser.cpp
+++ b/source/Interpreter/OptionArgParser.cpp
@@ -46,10 +46,10 @@ char OptionArgParser::ToChar(llvm::StringRef s, char fail_value,
}
int64_t OptionArgParser::ToOptionEnum(llvm::StringRef s,
- OptionEnumValueElement *enum_values,
+ const OptionEnumValues &enum_values,
int32_t fail_value, Status &error) {
error.Clear();
- if (!enum_values) {
+ if (enum_values.empty()) {
error.SetErrorString("invalid enumeration argument");
return fail_value;
}
@@ -59,16 +59,18 @@ int64_t OptionArgParser::ToOptionEnum(llvm::StringRef s,
return fail_value;
}
- for (int i = 0; enum_values[i].string_value != nullptr; i++) {
- llvm::StringRef this_enum(enum_values[i].string_value);
+ for (const auto &enum_value : enum_values) {
+ llvm::StringRef this_enum(enum_value.string_value);
if (this_enum.startswith(s))
- return enum_values[i].value;
+ return enum_value.value;
}
StreamString strm;
strm.PutCString("invalid enumeration value, valid values are: ");
- for (int i = 0; enum_values[i].string_value != nullptr; i++) {
- strm.Printf("%s\"%s\"", i > 0 ? ", " : "", enum_values[i].string_value);
+ bool is_first = true;
+ for (const auto &enum_value : enum_values) {
+ strm.Printf("%s\"%s\"",
+ is_first ? is_first = false,"" : ", ", enum_value.string_value);
}
error.SetErrorString(strm.GetString());
return fail_value;
diff --git a/source/Interpreter/OptionGroupArchitecture.cpp b/source/Interpreter/OptionGroupArchitecture.cpp
index bbd69b8f13fc..42eafc9872db 100644
--- a/source/Interpreter/OptionGroupArchitecture.cpp
+++ b/source/Interpreter/OptionGroupArchitecture.cpp
@@ -18,9 +18,9 @@ OptionGroupArchitecture::OptionGroupArchitecture() : m_arch_str() {}
OptionGroupArchitecture::~OptionGroupArchitecture() {}
-static OptionDefinition g_option_table[] = {
+static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "arch", 'a', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeArchitecture,
+ nullptr, {}, 0, eArgTypeArchitecture,
"Specify the architecture for the target."},
};
diff --git a/source/Interpreter/OptionGroupBoolean.cpp b/source/Interpreter/OptionGroupBoolean.cpp
index e3759f2e60a1..ca694ef5f488 100644
--- a/source/Interpreter/OptionGroupBoolean.cpp
+++ b/source/Interpreter/OptionGroupBoolean.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupBoolean.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
using namespace lldb;
@@ -32,7 +28,7 @@ OptionGroupBoolean::OptionGroupBoolean(uint32_t usage_mask, bool required,
m_option_definition.option_has_arg = no_argument_toggle_default
? OptionParser::eNoArgument
: OptionParser::eRequiredArgument;
- m_option_definition.enum_values = nullptr;
+ m_option_definition.enum_values = {};
m_option_definition.completion_type = 0;
m_option_definition.argument_type = eArgTypeBoolean;
m_option_definition.usage_text = usage_text;
diff --git a/source/Interpreter/OptionGroupFile.cpp b/source/Interpreter/OptionGroupFile.cpp
index d45f00a66616..241bad022ba7 100644
--- a/source/Interpreter/OptionGroupFile.cpp
+++ b/source/Interpreter/OptionGroupFile.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupFile.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
using namespace lldb;
@@ -30,7 +26,7 @@ OptionGroupFile::OptionGroupFile(uint32_t usage_mask, bool required,
m_option_definition.short_option = short_option;
m_option_definition.validator = nullptr;
m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
- m_option_definition.enum_values = nullptr;
+ m_option_definition.enum_values = {};
m_option_definition.completion_type = completion_type;
m_option_definition.argument_type = argument_type;
m_option_definition.usage_text = usage_text;
@@ -61,7 +57,7 @@ OptionGroupFileList::OptionGroupFileList(
m_option_definition.short_option = short_option;
m_option_definition.validator = nullptr;
m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
- m_option_definition.enum_values = nullptr;
+ m_option_definition.enum_values = {};
m_option_definition.completion_type = completion_type;
m_option_definition.argument_type = argument_type;
m_option_definition.usage_text = usage_text;
diff --git a/source/Interpreter/OptionGroupFormat.cpp b/source/Interpreter/OptionGroupFormat.cpp
index b64c19324810..6345a633635c 100644
--- a/source/Interpreter/OptionGroupFormat.cpp
+++ b/source/Interpreter/OptionGroupFormat.cpp
@@ -27,18 +27,18 @@ OptionGroupFormat::OptionGroupFormat(lldb::Format default_format,
OptionGroupFormat::~OptionGroupFormat() {}
-static OptionDefinition g_option_table[] = {
+static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "format", 'f', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeFormat,
+ nullptr, {}, 0, eArgTypeFormat,
"Specify a format to be used for display."},
{LLDB_OPT_SET_2, false, "gdb-format", 'G', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeGDBFormat,
+ nullptr, {}, 0, eArgTypeGDBFormat,
"Specify a format using a GDB format specifier string."},
{LLDB_OPT_SET_3, false, "size", 's', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeByteSize,
+ nullptr, {}, 0, eArgTypeByteSize,
"The size in bytes to use when displaying with the selected format."},
{LLDB_OPT_SET_4, false, "count", 'c', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeCount,
+ nullptr, {}, 0, eArgTypeCount,
"The number of total items to display."},
};
diff --git a/source/Interpreter/OptionGroupOutputFile.cpp b/source/Interpreter/OptionGroupOutputFile.cpp
index fd406494ea97..aebbf05131a0 100644
--- a/source/Interpreter/OptionGroupOutputFile.cpp
+++ b/source/Interpreter/OptionGroupOutputFile.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupOutputFile.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
using namespace lldb;
@@ -25,12 +21,12 @@ OptionGroupOutputFile::~OptionGroupOutputFile() {}
static const uint32_t SHORT_OPTION_APND = 0x61706e64; // 'apnd'
-static OptionDefinition g_option_table[] = {
+static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "outfile", 'o', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeFilename,
+ nullptr, {}, 0, eArgTypeFilename,
"Specify a path for capturing command output."},
{LLDB_OPT_SET_1, false, "append-outfile", SHORT_OPTION_APND,
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
"Append to the file specified with '--outfile <path>'."},
};
diff --git a/source/Interpreter/OptionGroupPlatform.cpp b/source/Interpreter/OptionGroupPlatform.cpp
index 47974276c8c0..5858fcc4aa48 100644
--- a/source/Interpreter/OptionGroupPlatform.cpp
+++ b/source/Interpreter/OptionGroupPlatform.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupPlatform.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/Platform.h"
@@ -65,21 +61,21 @@ void OptionGroupPlatform::OptionParsingStarting(
m_os_version = llvm::VersionTuple();
}
-static OptionDefinition g_option_table[] = {
+static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_ALL, false, "platform", 'p', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypePlatform, "Specify name of the platform to "
- "use for this target, creating the "
- "platform if necessary."},
+ nullptr, {}, 0, eArgTypePlatform, "Specify name of the platform to "
+ "use for this target, creating the "
+ "platform if necessary."},
{LLDB_OPT_SET_ALL, false, "version", 'v', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Specify the initial SDK version to use prior to connecting."},
{LLDB_OPT_SET_ALL, false, "build", 'b', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Specify the initial SDK build number."},
{LLDB_OPT_SET_ALL, false, "sysroot", 'S', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeFilename, "Specify the SDK root directory "
- "that contains a root of all "
- "remote system files."}};
+ nullptr, {}, 0, eArgTypeFilename, "Specify the SDK root directory "
+ "that contains a root of all "
+ "remote system files."}};
llvm::ArrayRef<OptionDefinition> OptionGroupPlatform::GetDefinitions() {
llvm::ArrayRef<OptionDefinition> result(g_option_table);
diff --git a/source/Interpreter/OptionGroupString.cpp b/source/Interpreter/OptionGroupString.cpp
index 1a161945a17f..1b1fbdf4f6ed 100644
--- a/source/Interpreter/OptionGroupString.cpp
+++ b/source/Interpreter/OptionGroupString.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupString.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
using namespace lldb;
@@ -31,7 +27,7 @@ OptionGroupString::OptionGroupString(uint32_t usage_mask, bool required,
m_option_definition.short_option = short_option;
m_option_definition.validator = nullptr;
m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
- m_option_definition.enum_values = nullptr;
+ m_option_definition.enum_values = {};
m_option_definition.completion_type = completion_type;
m_option_definition.argument_type = argument_type;
m_option_definition.usage_text = usage_text;
diff --git a/source/Interpreter/OptionGroupUInt64.cpp b/source/Interpreter/OptionGroupUInt64.cpp
index ae4828c3e926..bb2dcbbd23f9 100644
--- a/source/Interpreter/OptionGroupUInt64.cpp
+++ b/source/Interpreter/OptionGroupUInt64.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupUInt64.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
using namespace lldb;
@@ -31,7 +27,7 @@ OptionGroupUInt64::OptionGroupUInt64(uint32_t usage_mask, bool required,
m_option_definition.short_option = short_option;
m_option_definition.validator = nullptr;
m_option_definition.option_has_arg = OptionParser::eRequiredArgument;
- m_option_definition.enum_values = nullptr;
+ m_option_definition.enum_values = {};
m_option_definition.completion_type = completion_type;
m_option_definition.argument_type = argument_type;
m_option_definition.usage_text = usage_text;
diff --git a/source/Interpreter/OptionGroupUUID.cpp b/source/Interpreter/OptionGroupUUID.cpp
index bf02d1b660cf..0859877774cc 100644
--- a/source/Interpreter/OptionGroupUUID.cpp
+++ b/source/Interpreter/OptionGroupUUID.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupUUID.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
using namespace lldb;
@@ -22,9 +18,9 @@ OptionGroupUUID::OptionGroupUUID() : m_uuid() {}
OptionGroupUUID::~OptionGroupUUID() {}
-static OptionDefinition g_option_table[] = {
+static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeNone, "A module UUID value."},
+ nullptr, {}, 0, eArgTypeNone, "A module UUID value."},
};
llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
diff --git a/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/source/Interpreter/OptionGroupValueObjectDisplay.cpp
index 54b45c29c70d..40f219c8ab86 100644
--- a/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ b/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -28,46 +24,44 @@ OptionGroupValueObjectDisplay::OptionGroupValueObjectDisplay() {}
OptionGroupValueObjectDisplay::~OptionGroupValueObjectDisplay() {}
-static OptionDefinition g_option_table[] = {
+static const OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "dynamic-type", 'd',
- OptionParser::eRequiredArgument, nullptr, g_dynamic_value_types, 0,
+ OptionParser::eRequiredArgument, nullptr, GetDynamicValueTypes(), 0,
eArgTypeNone, "Show the object as its full dynamic type, not its static "
"type, if available."},
{LLDB_OPT_SET_1, false, "synthetic-type", 'S',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
+ OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean,
"Show the object obeying its synthetic provider, if available."},
{LLDB_OPT_SET_1, false, "depth", 'D', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeCount, "Set the max recurse depth when "
- "dumping aggregate types (default is "
- "infinity)."},
+ nullptr, {}, 0, eArgTypeCount, "Set the max recurse depth when dumping "
+ "aggregate types (default is infinity)."},
{LLDB_OPT_SET_1, false, "flat", 'F', OptionParser::eNoArgument, nullptr,
- nullptr, 0, eArgTypeNone, "Display results in a flat format that uses "
- "expression paths for each variable or member."},
+ {}, 0, eArgTypeNone, "Display results in a flat format that uses "
+ "expression paths for each variable or member."},
{LLDB_OPT_SET_1, false, "location", 'L', OptionParser::eNoArgument, nullptr,
- nullptr, 0, eArgTypeNone, "Show variable location information."},
+ {}, 0, eArgTypeNone, "Show variable location information."},
{LLDB_OPT_SET_1, false, "object-description", 'O',
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
"Print as an Objective-C object."},
{LLDB_OPT_SET_1, false, "ptr-depth", 'P', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeCount, "The number of pointers to be "
- "traversed when dumping values "
- "(default is zero)."},
+ nullptr, {}, 0, eArgTypeCount, "The number of pointers to be traversed "
+ "when dumping values (default is zero)."},
{LLDB_OPT_SET_1, false, "show-types", 'T', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Show variable types when dumping values."},
{LLDB_OPT_SET_1, false, "no-summary-depth", 'Y',
- OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeCount,
+ OptionParser::eOptionalArgument, nullptr, {}, 0, eArgTypeCount,
"Set the depth at which omitting summary information stops (default is "
"1)."},
{LLDB_OPT_SET_1, false, "raw-output", 'R', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone, "Don't use formatting options."},
+ nullptr, {}, 0, eArgTypeNone, "Don't use formatting options."},
{LLDB_OPT_SET_1, false, "show-all-children", 'A', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Ignore the upper bound on the number of children to show."},
{LLDB_OPT_SET_1, false, "validate", 'V', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeBoolean, "Show results of type validators."},
+ nullptr, {}, 0, eArgTypeBoolean, "Show results of type validators."},
{LLDB_OPT_SET_1, false, "element-count", 'Z',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount,
+ OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeCount,
"Treat the result of the expression as if its type is an array of this "
"many values."}};
@@ -86,8 +80,8 @@ Status OptionGroupValueObjectDisplay::SetOptionValue(
switch (short_option) {
case 'd': {
int32_t result;
- result = OptionArgParser::ToOptionEnum(option_arg, g_dynamic_value_types, 2,
- error);
+ result = OptionArgParser::ToOptionEnum(option_arg, GetDynamicValueTypes(),
+ 2, error);
if (error.Success())
use_dynamic = (lldb::DynamicValueType)result;
} break;
diff --git a/source/Interpreter/OptionGroupVariable.cpp b/source/Interpreter/OptionGroupVariable.cpp
index 7b7a62be8743..f90212cfcb2f 100644
--- a/source/Interpreter/OptionGroupVariable.cpp
+++ b/source/Interpreter/OptionGroupVariable.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupVariable.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -24,31 +20,34 @@ using namespace lldb_private;
// if you add any options here, remember to update the counters in
// OptionGroupVariable::GetNumDefinitions()
-static OptionDefinition g_variable_options[] = {
+static constexpr OptionDefinition g_variable_options[] = {
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-args", 'a',
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
"Omit function arguments."},
+ {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-recognized-args", 't',
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
+ "Omit recognized function arguments."},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-locals", 'l',
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
"Omit local variables."},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-globals", 'g',
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
"Show the current frame source file global and static variables."},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-declaration", 'c',
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
"Show variable declaration information (source file and line where the "
"variable was declared)."},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "regex", 'r',
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeRegularExpression,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeRegularExpression,
"The <variable-name> argument for name lookups are regular expressions."},
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "scope", 's',
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
"Show variable scope (argument, local, global, static)."},
{LLDB_OPT_SET_1, false, "summary", 'y', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeName,
+ nullptr, {}, 0, eArgTypeName,
"Specify the summary that the variable output should use."},
{LLDB_OPT_SET_2, false, "summary-string", 'z',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName,
+ OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName,
"Specify a summary string to use to format the variable output."},
};
@@ -56,8 +55,8 @@ static Status ValidateNamedSummary(const char *str, void *) {
if (!str || !str[0])
return Status("must specify a valid named summary");
TypeSummaryImplSP summary_sp;
- if (DataVisualization::NamedSummaryFormats::GetSummaryFormat(
- ConstString(str), summary_sp) == false)
+ if (!DataVisualization::NamedSummaryFormats::GetSummaryFormat(
+ ConstString(str), summary_sp))
return Status("must specify a valid named summary");
return Status();
}
@@ -101,6 +100,9 @@ OptionGroupVariable::SetOptionValue(uint32_t option_idx,
case 's':
show_scope = true;
break;
+ case 't':
+ show_recognized_args = false;
+ break;
case 'y':
error = summary.SetCurrentValue(option_arg);
break;
@@ -119,6 +121,7 @@ OptionGroupVariable::SetOptionValue(uint32_t option_idx,
void OptionGroupVariable::OptionParsingStarting(
ExecutionContext *execution_context) {
show_args = true; // Frame option only
+ show_recognized_args = true; // Frame option only
show_locals = true; // Frame option only
show_globals = false; // Frame option only
show_decl = false;
diff --git a/source/Interpreter/OptionGroupWatchpoint.cpp b/source/Interpreter/OptionGroupWatchpoint.cpp
index 0431fefaa7f9..36b4cc5ac4f6 100644
--- a/source/Interpreter/OptionGroupWatchpoint.cpp
+++ b/source/Interpreter/OptionGroupWatchpoint.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupWatchpoint.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/lldb-enumerations.h"
@@ -20,33 +16,31 @@
using namespace lldb;
using namespace lldb_private;
-static OptionEnumValueElement g_watch_type[] = {
+static constexpr OptionEnumValueElement g_watch_type[] = {
{OptionGroupWatchpoint::eWatchRead, "read", "Watch for read"},
{OptionGroupWatchpoint::eWatchWrite, "write", "Watch for write"},
{OptionGroupWatchpoint::eWatchReadWrite, "read_write",
- "Watch for read/write"},
- {0, nullptr, nullptr}};
+ "Watch for read/write"} };
-static OptionEnumValueElement g_watch_size[] = {
+static constexpr OptionEnumValueElement g_watch_size[] = {
{1, "1", "Watch for byte size of 1"},
{2, "2", "Watch for byte size of 2"},
{4, "4", "Watch for byte size of 4"},
- {8, "8", "Watch for byte size of 8"},
- {0, nullptr, nullptr}};
+ {8, "8", "Watch for byte size of 8"} };
-static OptionDefinition g_option_table[] = {
+static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "watch", 'w', OptionParser::eRequiredArgument,
- nullptr, g_watch_type, 0, eArgTypeWatchType,
+ nullptr, OptionEnumValues(g_watch_type), 0, eArgTypeWatchType,
"Specify the type of watching to perform."},
{LLDB_OPT_SET_1, false, "size", 's', OptionParser::eRequiredArgument,
- nullptr, g_watch_size, 0, eArgTypeByteSize,
+ nullptr, OptionEnumValues(g_watch_size), 0, eArgTypeByteSize,
"Number of bytes to use to watch a region."}};
bool OptionGroupWatchpoint::IsWatchSizeSupported(uint32_t watch_size) {
- for (uint32_t i = 0; i < llvm::array_lengthof(g_watch_size); ++i) {
- if (g_watch_size[i].value == 0)
+ for (const auto& size : g_watch_size) {
+ if (0 == size.value)
break;
- if (watch_size == g_watch_size[i].value)
+ if (watch_size == size.value)
return true;
}
return false;
diff --git a/source/Interpreter/OptionValue.cpp b/source/Interpreter/OptionValue.cpp
index c3f363b05988..4e480dd5784b 100644
--- a/source/Interpreter/OptionValue.cpp
+++ b/source/Interpreter/OptionValue.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValue.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Interpreter/OptionValues.h"
#include "lldb/Utility/StringList.h"
diff --git a/source/Interpreter/OptionValueArch.cpp b/source/Interpreter/OptionValueArch.cpp
index d4f1fcb8a70a..e4f0b9dd0df0 100644
--- a/source/Interpreter/OptionValueArch.cpp
+++ b/source/Interpreter/OptionValueArch.cpp
@@ -9,15 +9,11 @@
#include "lldb/Interpreter/OptionValueArch.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/State.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Args.h"
+#include "lldb/Utility/State.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Interpreter/OptionValueArgs.cpp b/source/Interpreter/OptionValueArgs.cpp
index 26e438548ea3..4fa9e187668d 100644
--- a/source/Interpreter/OptionValueArgs.cpp
+++ b/source/Interpreter/OptionValueArgs.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueArgs.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Utility/Args.h"
using namespace lldb;
diff --git a/source/Interpreter/OptionValueArray.cpp b/source/Interpreter/OptionValueArray.cpp
index d3fd1cb5db48..d755fa2fddb9 100644
--- a/source/Interpreter/OptionValueArray.cpp
+++ b/source/Interpreter/OptionValueArray.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueArray.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/StringConvert.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/Stream.h"
@@ -31,13 +27,17 @@ void OptionValueArray::DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
strm.Printf("(%s)", GetTypeAsCString());
}
if (dump_mask & eDumpOptionValue) {
- if (dump_mask & eDumpOptionType)
- strm.Printf(" =%s", (m_values.size() > 0) ? "\n" : "");
- strm.IndentMore();
+ const bool one_line = dump_mask & eDumpOptionCommand;
const uint32_t size = m_values.size();
+ if (dump_mask & eDumpOptionType)
+ strm.Printf(" =%s", (m_values.size() > 0 && !one_line) ? "\n" : "");
+ if (!one_line)
+ strm.IndentMore();
for (uint32_t i = 0; i < size; ++i) {
- strm.Indent();
- strm.Printf("[%u]: ", i);
+ if (!one_line) {
+ strm.Indent();
+ strm.Printf("[%u]: ", i);
+ }
const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0;
switch (array_element_type) {
default:
@@ -63,10 +63,16 @@ void OptionValueArray::DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
extra_dump_options);
break;
}
- if (i < (size - 1))
- strm.EOL();
+
+ if (!one_line) {
+ if (i < (size - 1))
+ strm.EOL();
+ } else {
+ strm << ' ';
+ }
}
- strm.IndentLess();
+ if (!one_line)
+ strm.IndentLess();
}
}
@@ -215,7 +221,7 @@ Status OptionValueArray::SetArgs(const Args &args, VarSetOperationType op) {
if (num_remove_indexes) {
// Sort and then erase in reverse so indexes are always valid
if (num_remove_indexes > 1) {
- std::sort(remove_indexes.begin(), remove_indexes.end());
+ llvm::sort(remove_indexes.begin(), remove_indexes.end());
for (std::vector<int>::const_reverse_iterator
pos = remove_indexes.rbegin(),
end = remove_indexes.rend();
diff --git a/source/Interpreter/OptionValueBoolean.cpp b/source/Interpreter/OptionValueBoolean.cpp
index 94c774d69111..a7fe10e79431 100644
--- a/source/Interpreter/OptionValueBoolean.cpp
+++ b/source/Interpreter/OptionValueBoolean.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueBoolean.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/PosixApi.h"
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/Utility/Stream.h"
diff --git a/source/Interpreter/OptionValueChar.cpp b/source/Interpreter/OptionValueChar.cpp
index 21fe88014724..1307b47a7134 100644
--- a/source/Interpreter/OptionValueChar.cpp
+++ b/source/Interpreter/OptionValueChar.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueChar.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StringList.h"
diff --git a/source/Interpreter/OptionValueDictionary.cpp b/source/Interpreter/OptionValueDictionary.cpp
index 2e8a8427237b..5058064f1ca2 100644
--- a/source/Interpreter/OptionValueDictionary.cpp
+++ b/source/Interpreter/OptionValueDictionary.cpp
@@ -9,15 +9,11 @@
#include "lldb/Interpreter/OptionValueDictionary.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
-// Project includes
-#include "lldb/Core/State.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Utility/Args.h"
+#include "lldb/Utility/State.h"
using namespace lldb;
using namespace lldb_private;
@@ -33,16 +29,23 @@ void OptionValueDictionary::DumpValue(const ExecutionContext *exe_ctx,
strm.Printf("(%s)", GetTypeAsCString());
}
if (dump_mask & eDumpOptionValue) {
+ const bool one_line = dump_mask & eDumpOptionCommand;
if (dump_mask & eDumpOptionType)
strm.PutCString(" =");
collection::iterator pos, end = m_values.end();
- strm.IndentMore();
+ if (!one_line)
+ strm.IndentMore();
for (pos = m_values.begin(); pos != end; ++pos) {
OptionValue *option_value = pos->second.get();
- strm.EOL();
+
+ if (one_line)
+ strm << ' ';
+ else
+ strm.EOL();
+
strm.Indent(pos->first.GetCString());
const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0;
@@ -74,7 +77,8 @@ void OptionValueDictionary::DumpValue(const ExecutionContext *exe_ctx,
break;
}
}
- strm.IndentLess();
+ if (!one_line)
+ strm.IndentLess();
}
}
diff --git a/source/Interpreter/OptionValueEnumeration.cpp b/source/Interpreter/OptionValueEnumeration.cpp
index c7cbcab7fcc8..e65dd2b67831 100644
--- a/source/Interpreter/OptionValueEnumeration.cpp
+++ b/source/Interpreter/OptionValueEnumeration.cpp
@@ -9,17 +9,13 @@
#include "lldb/Interpreter/OptionValueEnumeration.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Utility/StringList.h"
using namespace lldb;
using namespace lldb_private;
OptionValueEnumeration::OptionValueEnumeration(
- const OptionEnumValueElement *enumerators, enum_type value)
+ const OptionEnumValues &enumerators, enum_type value)
: OptionValue(), m_current_value(value), m_default_value(value),
m_enumerations() {
SetEnumerations(enumerators);
@@ -91,18 +87,16 @@ Status OptionValueEnumeration::SetValueFromString(llvm::StringRef value,
}
void OptionValueEnumeration::SetEnumerations(
- const OptionEnumValueElement *enumerators) {
+ const OptionEnumValues &enumerators) {
m_enumerations.Clear();
- if (enumerators) {
- for (size_t i = 0; enumerators[i].string_value != nullptr; ++i) {
- ConstString const_enumerator_name(enumerators[i].string_value);
- EnumeratorInfo enumerator_info = {enumerators[i].value,
- enumerators[i].usage};
- m_enumerations.Append(const_enumerator_name,
- enumerator_info);
- }
- m_enumerations.Sort();
+
+ for (const auto &enumerator : enumerators) {
+ ConstString const_enumerator_name(enumerator.string_value);
+ EnumeratorInfo enumerator_info = {enumerator.value, enumerator.usage};
+ m_enumerations.Append(const_enumerator_name, enumerator_info);
}
+
+ m_enumerations.Sort();
}
lldb::OptionValueSP OptionValueEnumeration::DeepCopy() const {
diff --git a/source/Interpreter/OptionValueFileSpec.cpp b/source/Interpreter/OptionValueFileSpec.cpp
index 2b93628679ce..735a7d86334d 100644
--- a/source/Interpreter/OptionValueFileSpec.cpp
+++ b/source/Interpreter/OptionValueFileSpec.cpp
@@ -9,13 +9,12 @@
#include "lldb/Interpreter/OptionValueFileSpec.h"
-#include "lldb/Core/State.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Args.h"
-#include "lldb/Utility/DataBufferLLVM.h"
+#include "lldb/Utility/State.h"
using namespace lldb;
using namespace lldb_private;
@@ -75,7 +74,9 @@ Status OptionValueFileSpec::SetValueFromString(llvm::StringRef value,
// or whitespace.
value = value.trim("\"' \t");
m_value_was_set = true;
- m_current_value.SetFile(value.str(), m_resolve, FileSpec::Style::native);
+ m_current_value.SetFile(value.str(), FileSpec::Style::native);
+ if (m_resolve)
+ FileSystem::Instance().Resolve(m_current_value);
m_data_sp.reset();
m_data_mod_time = llvm::sys::TimePoint<>();
NotifyValueChanged();
@@ -109,10 +110,11 @@ size_t OptionValueFileSpec::AutoComplete(CommandInterpreter &interpreter,
const lldb::DataBufferSP &OptionValueFileSpec::GetFileContents() {
if (m_current_value) {
- const auto file_mod_time = FileSystem::GetModificationTime(m_current_value);
+ const auto file_mod_time = FileSystem::Instance().GetModificationTime(m_current_value);
if (m_data_sp && m_data_mod_time == file_mod_time)
return m_data_sp;
- m_data_sp = DataBufferLLVM::CreateFromPath(m_current_value.GetPath());
+ m_data_sp =
+ FileSystem::Instance().CreateDataBuffer(m_current_value.GetPath());
m_data_mod_time = file_mod_time;
}
return m_data_sp;
diff --git a/source/Interpreter/OptionValueFileSpecLIst.cpp b/source/Interpreter/OptionValueFileSpecLIst.cpp
index 7fdc3c780239..fd78bba94fef 100644
--- a/source/Interpreter/OptionValueFileSpecLIst.cpp
+++ b/source/Interpreter/OptionValueFileSpecLIst.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueFileSpecList.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/StringConvert.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/Stream.h"
@@ -25,16 +21,24 @@ void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx,
if (dump_mask & eDumpOptionType)
strm.Printf("(%s)", GetTypeAsCString());
if (dump_mask & eDumpOptionValue) {
- if (dump_mask & eDumpOptionType)
- strm.Printf(" =%s", m_current_value.GetSize() > 0 ? "\n" : "");
- strm.IndentMore();
+ const bool one_line = dump_mask & eDumpOptionCommand;
const uint32_t size = m_current_value.GetSize();
+ if (dump_mask & eDumpOptionType)
+ strm.Printf(" =%s",
+ (m_current_value.GetSize() > 0 && !one_line) ? "\n" : "");
+ if (!one_line)
+ strm.IndentMore();
for (uint32_t i = 0; i < size; ++i) {
- strm.Indent();
- strm.Printf("[%u]: ", i);
+ if (!one_line) {
+ strm.Indent();
+ strm.Printf("[%u]: ", i);
+ }
m_current_value.GetFileSpecAtIndex(i).Dump(&strm);
+ if (one_line)
+ strm << ' ';
}
- strm.IndentLess();
+ if (!one_line)
+ strm.IndentLess();
}
}
@@ -61,7 +65,7 @@ Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
count);
} else {
for (size_t i = 1; i < argc; ++i, ++idx) {
- FileSpec file(args.GetArgumentAtIndex(i), false);
+ FileSpec file(args.GetArgumentAtIndex(i));
if (idx < count)
m_current_value.Replace(idx, file);
else
@@ -83,7 +87,7 @@ Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
if (argc > 0) {
m_value_was_set = true;
for (size_t i = 0; i < argc; ++i) {
- FileSpec file(args.GetArgumentAtIndex(i), false);
+ FileSpec file(args.GetArgumentAtIndex(i));
m_current_value.Append(file);
}
NotifyValueChanged();
@@ -107,7 +111,7 @@ Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
if (op == eVarSetOperationInsertAfter)
++idx;
for (size_t i = 1; i < argc; ++i, ++idx) {
- FileSpec file(args.GetArgumentAtIndex(i), false);
+ FileSpec file(args.GetArgumentAtIndex(i));
m_current_value.Insert(idx, file);
}
NotifyValueChanged();
@@ -136,7 +140,7 @@ Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
size_t num_remove_indexes = remove_indexes.size();
if (num_remove_indexes) {
// Sort and then erase in reverse so indexes are always valid
- std::sort(remove_indexes.begin(), remove_indexes.end());
+ llvm::sort(remove_indexes.begin(), remove_indexes.end());
for (size_t j = num_remove_indexes - 1; j < num_remove_indexes; ++j) {
m_current_value.Remove(j);
}
diff --git a/source/Interpreter/OptionValueFormat.cpp b/source/Interpreter/OptionValueFormat.cpp
index 1837804a4622..945d8bd33615 100644
--- a/source/Interpreter/OptionValueFormat.cpp
+++ b/source/Interpreter/OptionValueFormat.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueFormat.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/Utility/Stream.h"
diff --git a/source/Interpreter/OptionValueFormatEntity.cpp b/source/Interpreter/OptionValueFormatEntity.cpp
index ce1a84e8dece..18783625b86f 100644
--- a/source/Interpreter/OptionValueFormatEntity.cpp
+++ b/source/Interpreter/OptionValueFormatEntity.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueFormatEntity.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Core/Module.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Stream.h"
@@ -41,14 +37,30 @@ bool OptionValueFormatEntity::Clear() {
return true;
}
+static void EscapeBackticks(llvm::StringRef str, std::string &dst) {
+ dst.clear();
+ dst.reserve(str.size());
+
+ for (size_t i = 0, e = str.size(); i != e; ++i) {
+ char c = str[i];
+ if (c == '`') {
+ if (i == 0 || str[i - 1] != '\\')
+ dst += '\\';
+ }
+ dst += c;
+ }
+}
+
void OptionValueFormatEntity::DumpValue(const ExecutionContext *exe_ctx,
Stream &strm, uint32_t dump_mask) {
if (dump_mask & eDumpOptionType)
strm.Printf("(%s)", GetTypeAsCString());
if (dump_mask & eDumpOptionValue) {
if (dump_mask & eDumpOptionType)
- strm.PutCString(" = \"");
- strm << m_current_format.c_str() << '"';
+ strm.PutCString(" = ");
+ std::string escaped;
+ EscapeBackticks(m_current_format, escaped);
+ strm << '"' << escaped << '"';
}
}
diff --git a/source/Interpreter/OptionValueLanguage.cpp b/source/Interpreter/OptionValueLanguage.cpp
index 1a82329bf0f3..c6e168d66b4f 100644
--- a/source/Interpreter/OptionValueLanguage.cpp
+++ b/source/Interpreter/OptionValueLanguage.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueLanguage.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Target/Language.h"
#include "lldb/Utility/Args.h"
@@ -28,7 +24,8 @@ void OptionValueLanguage::DumpValue(const ExecutionContext *exe_ctx,
if (dump_mask & eDumpOptionValue) {
if (dump_mask & eDumpOptionType)
strm.PutCString(" = ");
- strm.PutCString(Language::GetNameForLanguageType(m_current_value));
+ if (m_current_value != eLanguageTypeUnknown)
+ strm.PutCString(Language::GetNameForLanguageType(m_current_value));
}
}
diff --git a/source/Interpreter/OptionValuePathMappings.cpp b/source/Interpreter/OptionValuePathMappings.cpp
index 8390a8cf5aba..11ec739c5bb9 100644
--- a/source/Interpreter/OptionValuePathMappings.cpp
+++ b/source/Interpreter/OptionValuePathMappings.cpp
@@ -9,10 +9,7 @@
#include "lldb/Interpreter/OptionValuePathMappings.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
+#include "lldb/Host/FileSystem.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/FileSpec.h"
@@ -23,7 +20,7 @@ using namespace lldb_private;
namespace {
static bool VerifyPathExists(const char *path) {
if (path && path[0])
- return FileSpec(path, false).Exists();
+ return FileSystem::Instance().Exists(path);
else
return false;
}
@@ -180,7 +177,7 @@ Status OptionValuePathMappings::SetValueFromString(llvm::StringRef value,
size_t num_remove_indexes = remove_indexes.size();
if (num_remove_indexes) {
// Sort and then erase in reverse so indexes are always valid
- std::sort(remove_indexes.begin(), remove_indexes.end());
+ llvm::sort(remove_indexes.begin(), remove_indexes.end());
for (size_t j = num_remove_indexes - 1; j < num_remove_indexes; ++j) {
m_path_mappings.Remove(j, m_notify_changes);
}
diff --git a/source/Interpreter/OptionValueProperties.cpp b/source/Interpreter/OptionValueProperties.cpp
index c1887f34b712..327d26b09ebb 100644
--- a/source/Interpreter/OptionValueProperties.cpp
+++ b/source/Interpreter/OptionValueProperties.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueProperties.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Utility/Flags.h"
#include "lldb/Core/UserSettingsController.h"
@@ -42,7 +38,7 @@ OptionValueProperties::OptionValueProperties(
for (size_t i = 0; i < num_properties; ++i) {
// Duplicate any values that are not global when constructing properties
// from a global copy
- if (m_properties[i].IsGlobal() == false) {
+ if (!m_properties[i].IsGlobal()) {
lldb::OptionValueSP new_value_sp(m_properties[i].GetValue()->DeepCopy());
m_properties[i].SetOptionValue(new_value_sp);
}
@@ -53,9 +49,9 @@ size_t OptionValueProperties::GetNumProperties() const {
return m_properties.size();
}
-void OptionValueProperties::Initialize(const PropertyDefinition *defs) {
- for (size_t i = 0; defs[i].name; ++i) {
- Property property(defs[i]);
+void OptionValueProperties::Initialize(const PropertyDefinitions &defs) {
+ for (const auto &definition : defs) {
+ Property property(definition);
assert(property.IsValid());
m_name_to_index.Append(ConstString(property.GetName()), m_properties.size());
property.GetValue()->SetParent(shared_from_this());
@@ -216,7 +212,7 @@ Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx,
else {
// Don't set an error if the path contained .experimental. - those are
// allowed to be missing and should silently fail.
- if (name_contains_experimental == false && error.AsCString() == nullptr) {
+ if (!name_contains_experimental && error.AsCString() == nullptr) {
error.SetErrorStringWithFormat("invalid value path '%s'", name.str().c_str());
}
}
diff --git a/source/Interpreter/OptionValueRegex.cpp b/source/Interpreter/OptionValueRegex.cpp
index aee8f97db163..3c06ff3957b0 100644
--- a/source/Interpreter/OptionValueRegex.cpp
+++ b/source/Interpreter/OptionValueRegex.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueRegex.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Utility/Stream.h"
using namespace lldb;
diff --git a/source/Interpreter/OptionValueSInt64.cpp b/source/Interpreter/OptionValueSInt64.cpp
index ddd1b9662ca3..c087c3ee24be 100644
--- a/source/Interpreter/OptionValueSInt64.cpp
+++ b/source/Interpreter/OptionValueSInt64.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueSInt64.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/StringConvert.h"
#include "lldb/Utility/Stream.h"
diff --git a/source/Interpreter/OptionValueString.cpp b/source/Interpreter/OptionValueString.cpp
index 8383b531270b..c89a0c6bf404 100644
--- a/source/Interpreter/OptionValueString.cpp
+++ b/source/Interpreter/OptionValueString.cpp
@@ -10,10 +10,6 @@
#include "lldb/Interpreter/OptionValueString.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/Stream.h"
diff --git a/source/Interpreter/OptionValueUInt64.cpp b/source/Interpreter/OptionValueUInt64.cpp
index c8db1bd532c6..053b5798880e 100644
--- a/source/Interpreter/OptionValueUInt64.cpp
+++ b/source/Interpreter/OptionValueUInt64.cpp
@@ -10,10 +10,6 @@
#include "lldb/Interpreter/OptionValueUInt64.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/StringConvert.h"
#include "lldb/Utility/Stream.h"
diff --git a/source/Interpreter/OptionValueUUID.cpp b/source/Interpreter/OptionValueUUID.cpp
index 355e07bb2b5f..5518a0574112 100644
--- a/source/Interpreter/OptionValueUUID.cpp
+++ b/source/Interpreter/OptionValueUUID.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionValueUUID.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Core/Module.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Stream.h"
diff --git a/source/Interpreter/Options.cpp b/source/Interpreter/Options.cpp
index c9567e91f6b8..c6357399a7e2 100644
--- a/source/Interpreter/Options.cpp
+++ b/source/Interpreter/Options.cpp
@@ -9,15 +9,11 @@
#include "lldb/Interpreter/Options.h"
-// C Includes
-// C++ Includes
#include <algorithm>
#include <bitset>
#include <map>
#include <set>
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -461,7 +457,7 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
}
}
- if (options.empty() == false) {
+ if (!options.empty()) {
// We have some required options with no arguments
strm.PutCString(" -");
for (i = 0; i < 2; ++i)
@@ -480,14 +476,14 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
if (def.usage_mask & opt_set_mask && isprint8(def.short_option)) {
// Add current option to the end of out_stream.
- if (def.required == false &&
+ if (!def.required &&
def.option_has_arg == OptionParser::eNoArgument) {
options.insert(def.short_option);
}
}
}
- if (options.empty() == false) {
+ if (!options.empty()) {
// We have some required options with no arguments
strm.PutCString(" [-");
for (i = 0; i < 2; ++i)
@@ -601,15 +597,17 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
if (opt_defs[i].usage_text)
OutputFormattedUsageText(strm, opt_defs[i], screen_width);
- if (opt_defs[i].enum_values != nullptr) {
+ if (!opt_defs[i].enum_values.empty()) {
strm.Indent();
strm.Printf("Values: ");
- for (int k = 0; opt_defs[i].enum_values[k].string_value != nullptr;
- k++) {
- if (k == 0)
- strm.Printf("%s", opt_defs[i].enum_values[k].string_value);
+ bool is_first = true;
+ for (const auto &enum_value : opt_defs[i].enum_values) {
+ if (is_first) {
+ strm.Printf("%s", enum_value.string_value);
+ is_first = false;
+ }
else
- strm.Printf(" | %s", opt_defs[i].enum_values[k].string_value);
+ strm.Printf(" | %s", enum_value.string_value);
}
strm.EOL();
}
@@ -770,17 +768,18 @@ bool Options::HandleOptionArgumentCompletion(
// See if this is an enumeration type option, and if so complete it here:
- OptionEnumValueElement *enum_values = opt_defs[opt_defs_index].enum_values;
- if (enum_values != nullptr) {
+ const auto &enum_values = opt_defs[opt_defs_index].enum_values;
+ if (!enum_values.empty()) {
bool return_value = false;
std::string match_string(
request.GetParsedLine().GetArgumentAtIndex(opt_arg_pos),
request.GetParsedLine().GetArgumentAtIndex(opt_arg_pos) +
request.GetCursorCharPosition());
- for (int i = 0; enum_values[i].string_value != nullptr; i++) {
- if (strstr(enum_values[i].string_value, match_string.c_str()) ==
- enum_values[i].string_value) {
- request.AddCompletion(enum_values[i].string_value);
+
+ for (const auto &enum_value : enum_values) {
+ if (strstr(enum_value.string_value, match_string.c_str()) ==
+ enum_value.string_value) {
+ request.AddCompletion(enum_value.string_value);
return_value = true;
}
}
@@ -828,7 +827,7 @@ bool Options::HandleOptionArgumentCompletion(
const char *module_name =
request.GetParsedLine().GetArgumentAtIndex(cur_arg_pos);
if (module_name) {
- FileSpec module_spec(module_name, false);
+ FileSpec module_spec(module_name);
lldb::TargetSP target_sp =
interpreter.GetDebugger().GetSelectedTarget();
// Search filters require a target...
diff --git a/source/Interpreter/Property.cpp b/source/Interpreter/Property.cpp
index 369029bc570d..5f1022347cf4 100644
--- a/source/Interpreter/Property.cpp
+++ b/source/Interpreter/Property.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/Property.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -102,8 +98,10 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_uint_value" represents if the
// "definition.default_cstr_value" should be resolved or not
const bool resolve = definition.default_uint_value != 0;
- m_value_sp.reset(new OptionValueFileSpec(
- FileSpec(definition.default_cstr_value, resolve), resolve));
+ FileSpec file_spec = FileSpec(definition.default_cstr_value);
+ if (resolve)
+ FileSystem::Instance().Resolve(file_spec);
+ m_value_sp.reset(new OptionValueFileSpec(file_spec, resolve));
break;
}
@@ -233,7 +231,10 @@ void Property::Dump(const ExecutionContext *exe_ctx, Stream &strm,
uint32_t dump_mask) const {
if (m_value_sp) {
const bool dump_desc = dump_mask & OptionValue::eDumpOptionDescription;
+ const bool dump_cmd = dump_mask & OptionValue::eDumpOptionCommand;
const bool transparent = m_value_sp->ValueIsTransparent();
+ if (dump_cmd && !transparent)
+ strm << "settings set -f ";
if (dump_desc || !transparent) {
if ((dump_mask & OptionValue::eDumpOptionName) && m_name) {
DumpQualifiedName(strm);