[Lldb-commits] [lldb] r287631 - Fix build failure on Linux and BSD by reverting r287597
Omair Javaid via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 22 01:47:01 PST 2016
Author: omjavaid
Date: Tue Nov 22 03:47:00 2016
New Revision: 287631
URL: http://llvm.org/viewvc/llvm-project?rev=287631&view=rev
Log:
Fix build failure on Linux and BSD by reverting r287597
Linux and BSD builds failing after this changes from rev 287597.
Modified:
lldb/trunk/include/lldb/Interpreter/Args.h
lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
Modified: lldb/trunk/include/lldb/Interpreter/Args.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=287631&r1=287630&r2=287631&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Args.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Args.h Tue Nov 22 03:47:00 2016
@@ -150,13 +150,8 @@ public:
const char *GetArgumentAtIndex(size_t idx) const;
llvm::ArrayRef<ArgEntry> entries() const { return m_entries; }
- char GetArgumentQuoteCharAtIndex(size_t idx) const;
-
- auto begin() const { return m_entries.begin(); }
- auto end() const { return m_entries.end(); }
- size_t size() const { return GetArgumentCount(); }
- const ArgEntry &operator[](size_t n) const { return m_entries[n]; }
+ char GetArgumentQuoteCharAtIndex(size_t idx) const;
//------------------------------------------------------------------
/// Gets the argument vector.
Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=287631&r1=287630&r2=287631&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Tue Nov 22 03:47:00 2016
@@ -122,12 +122,13 @@ void BreakpointIDList::FindAndReplaceIDR
llvm::StringRef range_from;
llvm::StringRef range_to;
llvm::StringRef current_arg;
+ const size_t num_old_args = old_args.GetArgumentCount();
std::set<std::string> names_found;
- for (size_t i = 0; i < old_args.size(); ++i) {
+ for (size_t i = 0; i < num_old_args; ++i) {
bool is_range = false;
- current_arg = old_args[i].ref;
+ current_arg = old_args.GetArgumentAtIndex(i);
if (!allow_locations && current_arg.contains('.')) {
result.AppendErrorWithFormat(
"Breakpoint locations not allowed, saw location: %s.",
@@ -151,17 +152,19 @@ void BreakpointIDList::FindAndReplaceIDR
return;
} else
names_found.insert(current_arg);
- } else if ((i + 2 < old_args.size()) &&
- BreakpointID::IsRangeIdentifier(old_args[i + 1].ref) &&
+ } else if ((i + 2 < num_old_args) &&
+ BreakpointID::IsRangeIdentifier(
+ old_args.GetArgumentAtIndex(i + 1)) &&
BreakpointID::IsValidIDExpression(current_arg) &&
- BreakpointID::IsValidIDExpression(old_args[i + 2].ref)) {
+ BreakpointID::IsValidIDExpression(
+ old_args.GetArgumentAtIndex(i + 2))) {
range_from = current_arg;
- range_to = old_args[i + 2].ref;
+ range_to = old_args.GetArgumentAtIndex(i + 2);
is_range = true;
i = i + 2;
} else {
// See if user has specified id.*
- llvm::StringRef tmp_str = old_args[i].ref;
+ llvm::StringRef tmp_str = old_args.GetArgumentAtIndex(i);
size_t pos = tmp_str.find('.');
if (pos != llvm::StringRef::npos) {
llvm::StringRef bp_id_str = tmp_str.substr(0, pos);
Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=287631&r1=287630&r2=287631&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Tue Nov 22 03:47:00 2016
@@ -1476,12 +1476,12 @@ public:
int match_start_point, int max_return_elements,
bool &word_complete,
StringList &matches) override {
- llvm::StringRef completion_str = input[cursor_index].ref;
- completion_str = completion_str.take_front(cursor_char_position);
+ std::string completion_str(input.GetArgumentAtIndex(cursor_index));
+ completion_str.erase(cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(
GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
- completion_str, match_start_point, max_return_elements, nullptr,
+ completion_str.c_str(), match_start_point, max_return_elements, nullptr,
word_complete, matches);
return matches.GetSize();
}
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=287631&r1=287630&r2=287631&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Nov 22 03:47:00 2016
@@ -473,12 +473,12 @@ public:
bool &word_complete,
StringList &matches) override {
// Arguments are the standard source file completer.
- auto completion_str = input[cursor_index].ref;
- completion_str = completion_str.take_front(cursor_char_position);
+ std::string completion_str(input.GetArgumentAtIndex(cursor_index));
+ completion_str.erase(cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(
GetCommandInterpreter(), CommandCompletions::eVariablePathCompletion,
- completion_str, match_start_point, max_return_elements, nullptr,
+ completion_str.c_str(), match_start_point, max_return_elements, nullptr,
word_complete, matches);
return matches.GetSize();
}
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=287631&r1=287630&r2=287631&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Nov 22 03:47:00 2016
@@ -1558,8 +1558,9 @@ protected:
int num_signals_set = 0;
if (num_args > 0) {
- for (const auto &arg : signal_args) {
- int32_t signo = signals_sp->GetSignalNumberFromName(arg.c_str());
+ for (size_t i = 0; i < num_args; ++i) {
+ int32_t signo = signals_sp->GetSignalNumberFromName(
+ signal_args.GetArgumentAtIndex(i));
if (signo != LLDB_INVALID_SIGNAL_NUMBER) {
// Casting the actions as bools here should be okay, because
// VerifyCommandOptionValue guarantees
@@ -1575,7 +1576,7 @@ protected:
++num_signals_set;
} else {
result.AppendErrorWithFormat("Invalid signal name '%s'\n",
- arg.c_str());
+ signal_args.GetArgumentAtIndex(i));
}
}
} else {
Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=287631&r1=287630&r2=287631&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Tue Nov 22 03:47:00 2016
@@ -293,10 +293,15 @@ protected:
bool DoExecute(Args &args, CommandReturnObject &result) override {
result.SetStatus(eReturnStatusSuccessFinishResult);
+ const size_t argc = args.GetArgumentCount();
if (!args.empty()) {
- for (const auto &arg : args) {
+ // TODO: Convert this to StringRef based enumeration. Requires converting
+ // DumpPropertyValue first.
+ for (size_t i = 0; i < argc; ++i) {
+ const char *property_path = args.GetArgumentAtIndex(i);
+
Error error(m_interpreter.GetDebugger().DumpPropertyValue(
- &m_exe_ctx, result.GetOutputStream(), arg.ref,
+ &m_exe_ctx, result.GetOutputStream(), property_path,
OptionValue::eDumpGroupValue));
if (error.Success()) {
result.GetOutputStream().EOL();
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=287631&r1=287630&r2=287631&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Nov 22 03:47:00 2016
@@ -1859,8 +1859,9 @@ int CommandInterpreter::HandleCompletion
// put an empty string in element 0.
std::string command_partial_str;
if (cursor_index >= 0)
- command_partial_str =
- parsed_line[cursor_index].ref.take_front(cursor_char_position);
+ command_partial_str.assign(parsed_line.GetArgumentAtIndex(cursor_index),
+ parsed_line.GetArgumentAtIndex(cursor_index) +
+ cursor_char_position);
std::string common_prefix;
matches.LongestCommonPrefix(common_prefix);
@@ -1871,7 +1872,7 @@ int CommandInterpreter::HandleCompletion
// Only do this if the completer told us this was a complete word,
// however...
if (num_command_matches == 1 && word_complete) {
- char quote_char = parsed_line[cursor_index].quote;
+ char quote_char = parsed_line.GetArgumentQuoteCharAtIndex(cursor_index);
common_prefix =
Args::EscapeLLDBCommandArgument(common_prefix, quote_char);
if (quote_char != '\0')
Modified: lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueDictionary.cpp?rev=287631&r1=287630&r2=287631&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueDictionary.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueDictionary.cpp Tue Nov 22 03:47:00 2016
@@ -101,74 +101,73 @@ Error OptionValueDictionary::SetArgs(con
case eVarSetOperationAppend:
case eVarSetOperationReplace:
case eVarSetOperationAssign:
- if (argc == 0) {
- error.SetErrorString(
- "assign operation takes one or more key=value arguments");
- return error;
- }
- for (const auto &entry : args) {
- if (entry.ref.empty()) {
- error.SetErrorString("empty argument");
- return error;
- }
- if (!entry.ref.contains('=')) {
- error.SetErrorString(
- "assign operation takes one or more key=value arguments");
- return error;
- }
-
- llvm::StringRef key, value;
- std::tie(key, value) = entry.ref.split('=');
- bool key_valid = false;
- if (key.empty()) {
- error.SetErrorString("empty dictionary key");
- return error;
- }
+ if (argc > 0) {
+ for (size_t i = 0; i < argc; ++i) {
+ llvm::StringRef key_and_value(args.GetArgumentAtIndex(i));
+ if (!key_and_value.empty()) {
+ if (key_and_value.find('=') == llvm::StringRef::npos) {
+ error.SetErrorString(
+ "assign operation takes one or more key=value arguments");
+ return error;
+ }
- if (key.front() == '[') {
- // Key name starts with '[', so the key value must be in single or
- // double quotes like:
- // ['<key>']
- // ["<key>"]
- if ((key.size() > 2) && (key.back() == ']')) {
- // Strip leading '[' and trailing ']'
- key = key.substr(1, key.size() - 2);
- const char quote_char = key.front();
- if ((quote_char == '\'') || (quote_char == '"')) {
- if ((key.size() > 2) && (key.back() == quote_char)) {
- // Strip the quotes
- key = key.substr(1, key.size() - 2);
+ std::pair<llvm::StringRef, llvm::StringRef> kvp(
+ key_and_value.split('='));
+ llvm::StringRef key = kvp.first;
+ bool key_valid = false;
+ if (!key.empty()) {
+ if (key.front() == '[') {
+ // Key name starts with '[', so the key value must be in single or
+ // double quotes like:
+ // ['<key>']
+ // ["<key>"]
+ if ((key.size() > 2) && (key.back() == ']')) {
+ // Strip leading '[' and trailing ']'
+ key = key.substr(1, key.size() - 2);
+ const char quote_char = key.front();
+ if ((quote_char == '\'') || (quote_char == '"')) {
+ if ((key.size() > 2) && (key.back() == quote_char)) {
+ // Strip the quotes
+ key = key.substr(1, key.size() - 2);
+ key_valid = true;
+ }
+ } else {
+ // square brackets, no quotes
+ key_valid = true;
+ }
+ }
+ } else {
+ // No square brackets or quotes
key_valid = true;
}
+ }
+ if (!key_valid) {
+ error.SetErrorStringWithFormat(
+ "invalid key \"%s\", the key must be a bare string or "
+ "surrounded by brackets with optional quotes: [<key>] or "
+ "['<key>'] or [\"<key>\"]",
+ kvp.first.str().c_str());
+ return error;
+ }
+
+ lldb::OptionValueSP value_sp(CreateValueFromCStringForTypeMask(
+ kvp.second.data(), m_type_mask, error));
+ if (value_sp) {
+ if (error.Fail())
+ return error;
+ m_value_was_set = true;
+ SetValueForKey(ConstString(key), value_sp, true);
} else {
- // square brackets, no quotes
- key_valid = true;
+ error.SetErrorString("dictionaries that can contain multiple types "
+ "must subclass OptionValueArray");
}
+ } else {
+ error.SetErrorString("empty argument");
}
- } else {
- // No square brackets or quotes
- key_valid = true;
- }
- if (!key_valid) {
- error.SetErrorStringWithFormat(
- "invalid key \"%s\", the key must be a bare string or "
- "surrounded by brackets with optional quotes: [<key>] or "
- "['<key>'] or [\"<key>\"]",
- key.str().c_str());
- return error;
- }
-
- lldb::OptionValueSP value_sp(CreateValueFromCStringForTypeMask(
- value.str().c_str(), m_type_mask, error));
- if (value_sp) {
- if (error.Fail())
- return error;
- m_value_was_set = true;
- SetValueForKey(ConstString(key), value_sp, true);
- } else {
- error.SetErrorString("dictionaries that can contain multiple types "
- "must subclass OptionValueArray");
}
+ } else {
+ error.SetErrorString(
+ "assign operation takes one or more key=value arguments");
}
break;
More information about the lldb-commits
mailing list