Cleaned up many error codes. For any who is filling in error strings into
lldb_private::Error objects the rules are:
- short strings that don't start with a capitol letter unless the name is a
class or anything else that is always capitolized
- no trailing newline character
- should be one line if possible
Implemented a first pass at adding "--gdb-format" support to anything that
accepts format with optional size/count.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142999 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index 3336baf..cf9ecb0 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -84,7 +84,7 @@
case 'l':
error = m_num_per_line.SetValueFromCString (option_arg);
if (m_num_per_line.GetCurrentValue() == 0)
- error.SetErrorStringWithFormat("Invalid value for --num-per-line option '%s'. Must be positive integer value.\n", option_arg);
+ error.SetErrorStringWithFormat("invalid value for --num-per-line option '%s'", option_arg);
break;
case 'b':
@@ -96,7 +96,7 @@
break;
default:
- error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option);
+ error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
break;
}
return error;
@@ -116,28 +116,10 @@
Error error;
OptionValueUInt64 &byte_size_value = format_options.GetByteSizeValue();
OptionValueUInt64 &count_value = format_options.GetCountValue();
- bool byte_size_option_set = byte_size_value.OptionWasSet();
+ const bool byte_size_option_set = byte_size_value.OptionWasSet();
const bool num_per_line_option_set = m_num_per_line.OptionWasSet();
const bool count_option_set = format_options.GetCountValue().OptionWasSet();
- uint32_t format_byte_size = byte_size_value.GetCurrentValue();
- if (byte_size_option_set)
- {
- if (format_byte_size > 0)
- {
- error.SetErrorString("can't specify the byte size in both the '--size <num>' option and the '--format [<byte-size>]<format-char>' options.");
- return error;
- }
- }
- else
- {
- if (format_byte_size != 0)
- {
- byte_size_option_set = true;
- byte_size_value = format_byte_size;
- }
- }
-
switch (format_options.GetFormat())
{
default:
@@ -181,7 +163,7 @@
case eFormatBytes:
case eFormatBytesWithASCII:
- if (byte_size_value.OptionWasSet())
+ if (byte_size_option_set)
{
if (byte_size_value > 1)
error.SetErrorString ("use --count option to specify an end address to display a number of bytes");
@@ -751,7 +733,7 @@
if (!m_infile.Exists())
{
m_infile.Clear();
- error.SetErrorStringWithFormat("Input file does not exist: '%s'\n", option_arg);
+ error.SetErrorStringWithFormat("input file does not exist: '%s'", option_arg);
}
break;
@@ -761,13 +743,13 @@
m_infile_offset = Args::StringToUInt64(option_arg, 0, 0, &success);
if (!success)
{
- error.SetErrorStringWithFormat("Invalid offset string '%s'\n", option_arg);
+ error.SetErrorStringWithFormat("invalid offset string '%s'", option_arg);
}
}
break;
default:
- error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option);
+ error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
break;
}
return error;