diff options
45 files changed, 414 insertions, 243 deletions
diff --git a/lldb/include/lldb/Interpreter/OptionGroupFormat.h b/lldb/include/lldb/Interpreter/OptionGroupFormat.h index 5208aa7..5329ffd 100644 --- a/lldb/include/lldb/Interpreter/OptionGroupFormat.h +++ b/lldb/include/lldb/Interpreter/OptionGroupFormat.h @@ -97,9 +97,17 @@ public: protected: + lldb::Format + SetFormatUsingGDBFormatLetter (char format_letter); + + uint32_t + SetByteSizeUsingGDBSizeLetter (char size_letter); + OptionValueFormat m_format; OptionValueUInt64 m_byte_size; OptionValueUInt64 m_count; + char m_prev_gdb_format; + char m_prev_gdb_size; }; } // namespace lldb_private diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 4f74108..7e068b2 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -361,6 +361,7 @@ namespace lldb { eArgTypeFrameIndex, eArgTypeFullName, eArgTypeFunctionName, + eArgTypeGDBFormat, eArgTypeIndex, eArgTypeLineNum, eArgTypeLogCategory, diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index 6c24e98..cc3b841 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -732,7 +732,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame, sb_error.SetErrorStringWithFormat("No line entries for %s:%u", path, line); } else - sb_error.SetErrorString ("Step until target not in current function.\n"); + sb_error.SetErrorString ("step until target not in current function"); } else { diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp index c0f9454..dfbbe79 100644 --- a/lldb/source/Commands/CommandObjectArgs.cpp +++ b/lldb/source/Commands/CommandObjectArgs.cpp @@ -58,7 +58,7 @@ CommandObjectArgs::CommandOptions::SetOptionValue (uint32_t option_idx, const ch switch (short_option) { default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index b3eec69..34cfc78 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -154,7 +154,7 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (uint32_t option_idx, m_load_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 16); if (m_load_addr == LLDB_INVALID_ADDRESS) - error.SetErrorStringWithFormat ("Invalid address string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid address string '%s'", option_arg); break; case 'c': @@ -211,14 +211,14 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (uint32_t option_idx, { m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0); if (m_ignore_count == UINT32_MAX) - error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg); } break; case 't' : { m_thread_id = Args::StringToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0); if (m_thread_id == LLDB_INVALID_THREAD_ID) - error.SetErrorStringWithFormat ("Invalid thread id string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg); } break; case 'T': @@ -231,12 +231,12 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (uint32_t option_idx, { m_thread_index = Args::StringToUInt32(option_arg, UINT32_MAX, 0); if (m_thread_id == UINT32_MAX) - error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg); } break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -689,7 +689,7 @@ CommandObjectBreakpointList::CommandOptions::SetOptionValue (uint32_t option_idx m_internal = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -1057,7 +1057,7 @@ CommandObjectBreakpointClear::CommandOptions::SetOptionValue (uint32_t option_id break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -1369,7 +1369,7 @@ CommandObjectBreakpointModify::CommandOptions::SetOptionValue (uint32_t option_i { m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0); if (m_ignore_count == UINT32_MAX) - error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg); } break; case 't' : @@ -1383,7 +1383,7 @@ CommandObjectBreakpointModify::CommandOptions::SetOptionValue (uint32_t option_i { m_thread_id = Args::StringToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0); if (m_thread_id == LLDB_INVALID_THREAD_ID) - error.SetErrorStringWithFormat ("Invalid thread id string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg); else m_thread_id_passed = true; } @@ -1414,14 +1414,14 @@ CommandObjectBreakpointModify::CommandOptions::SetOptionValue (uint32_t option_i { m_thread_index = Args::StringToUInt32 (option_arg, UINT32_MAX, 0); if (m_thread_id == UINT32_MAX) - error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg); else m_thread_index_passed = true; } } break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 942d7ff8..16c3c01 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -120,7 +120,7 @@ CommandObjectBreakpointCommandAdd::CommandOptions::SetOptionValue bool success = false; m_stop_on_error = Args::StringToBoolean(option_arg, false, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for stop-on-error: \"%s\".\n", option_arg); + error.SetErrorStringWithFormat("invalid value for stop-on-error: \"%s\"", option_arg); } break; diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index ba81f28..cb43f65 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -62,7 +62,7 @@ private: case 'c': m_end_idx = Args::StringToUInt32(option_arg, UINT_MAX, 0, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for count: %s.\n", option_arg); + error.SetErrorStringWithFormat("invalid value for count: %s", option_arg); if (m_end_idx != 0) m_end_idx--; m_start_idx = 0; @@ -70,15 +70,15 @@ private: case 'e': m_end_idx = Args::StringToUInt32(option_arg, 0, 0, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for end index: %s.\n", option_arg); + error.SetErrorStringWithFormat("invalid value for end index: %s", option_arg); break; case 's': m_start_idx = Args::StringToUInt32(option_arg, 0, 0, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for start index: %s.\n", option_arg); + error.SetErrorStringWithFormat("invalid value for start index: %s", option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -188,15 +188,15 @@ private: case 'e': m_stop_on_error = Args::StringToBoolean(option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for stop-on-error: %s.\n", option_arg); + error.SetErrorStringWithFormat("invalid value for stop-on-error: %s", option_arg); break; case 'c': m_stop_on_continue = Args::StringToBoolean(option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for stop-on-continue: %s.\n", option_arg); + error.SetErrorStringWithFormat("invalid value for stop-on-continue: %s", option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -478,7 +478,7 @@ public: if (!cmd_obj) { - result.AppendErrorWithFormat ("Invalid command given to 'alias'. '%s' does not begin with a valid command." + result.AppendErrorWithFormat ("invalid command given to 'alias'. '%s' does not begin with a valid command." " No alias created.", raw_command_string.c_str()); result.SetStatus (eReturnStatusFailed); return false; @@ -1008,7 +1008,7 @@ private: break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -1325,7 +1325,7 @@ private: m_funct_name = std::string(option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp index 5c7b485..c2d8968 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -71,13 +71,13 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c case 'C': num_lines_context = Args::StringToUInt32(option_arg, 0, 0, &success); if (!success) - error.SetErrorStringWithFormat ("Invalid num context lines string: \"%s\".\n", option_arg); + error.SetErrorStringWithFormat ("invalid num context lines string: \"%s\"", option_arg); break; case 'c': num_instructions = Args::StringToUInt32(option_arg, 0, 0, &success); if (!success) - error.SetErrorStringWithFormat ("Invalid num of instructions string: \"%s\".\n", option_arg); + error.SetErrorStringWithFormat ("invalid num of instructions string: \"%s\"", option_arg); break; case 'b': @@ -90,7 +90,7 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c start_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 16); if (start_addr == LLDB_INVALID_ADDRESS) - error.SetErrorStringWithFormat ("Invalid start address string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid start address string '%s'", option_arg); some_location_specified = true; break; case 'e': @@ -99,7 +99,7 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c end_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 16); if (end_addr == LLDB_INVALID_ADDRESS) - error.SetErrorStringWithFormat ("Invalid end address string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid end address string '%s'", option_arg); break; some_location_specified = true; case 'n': @@ -138,7 +138,7 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c break; default: - error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option); + error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index dde97b2..29fea1e 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -76,7 +76,7 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int //case 'l': //if (language.SetLanguageFromCString (option_arg) == false) //{ - // error.SetErrorStringWithFormat("Invalid language option argument '%s'.\n", option_arg); + // error.SetErrorStringWithFormat("invalid language option argument '%s'", option_arg); //} //break; @@ -90,7 +90,7 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int bool result; result = Args::StringToBoolean(option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid dynamic value setting: \"%s\".\n", option_arg); + error.SetErrorStringWithFormat("invalid dynamic value setting: \"%s\"", option_arg); else { if (result) @@ -106,11 +106,11 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int bool success; unwind_on_error = Args::StringToBoolean(option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Could not convert \"%s\" to a boolean value.", option_arg); + error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg); break; } default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index c752812..36f785a 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -127,11 +127,11 @@ public: case 'r': relative_frame_offset = Args::StringToSInt32 (option_arg, INT32_MIN, 0, &success); if (!success) - error.SetErrorStringWithFormat ("invalid frame offset argument '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid frame offset argument '%s'", option_arg); break; default: - error.SetErrorStringWithFormat ("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat ("invalid short option character '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectHelp.h b/lldb/source/Commands/CommandObjectHelp.h index c089048..ff6bd55 100644 --- a/lldb/source/Commands/CommandObjectHelp.h +++ b/lldb/source/Commands/CommandObjectHelp.h @@ -72,7 +72,7 @@ public: m_show_user_defined = false; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 7dcfabc..8a1688e 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -210,7 +210,7 @@ public: case 'p': log_options |= LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD;break; case 'n': log_options |= LLDB_LOG_OPTION_PREPEND_THREAD_NAME; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 3336bafe..cf9ecb01 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -84,7 +84,7 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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; diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 0cea39c..615bf3c 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -71,7 +71,7 @@ public: in_new_tty = true; break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } @@ -442,7 +442,7 @@ public: pid = Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success); if (!success || pid == LLDB_INVALID_PROCESS_ID) { - error.SetErrorStringWithFormat("Invalid process ID '%s'.\n", option_arg); + error.SetErrorStringWithFormat("invalid process ID '%s'", option_arg); } break; @@ -459,7 +459,7 @@ public: break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } return error; @@ -976,7 +976,7 @@ public: break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } return error; @@ -1541,7 +1541,7 @@ public: pass = option_arg; break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } return error; diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index a699118..f1ef8375 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -311,7 +311,7 @@ public: break; default: - error.SetErrorStringWithFormat("Unrecognized short option '%c'\n", short_option); + error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option); break; } return error; diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index e43c16a..2421af5 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -265,7 +265,7 @@ CommandObjectSettingsSet::CommandOptions::SetOptionValue (uint32_t option_idx, c m_reset = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized options '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized options '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 204b4b8..5baf5e6 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -57,7 +57,7 @@ class CommandObjectSourceInfo : public CommandObject case 'l': start_line = Args::StringToUInt32 (option_arg, 0); if (start_line == 0) - error.SetErrorStringWithFormat("Invalid line number: '%s'.\n", option_arg); + error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg); break; case 'f': @@ -65,7 +65,7 @@ class CommandObjectSourceInfo : public CommandObject break; default: - error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option); + error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option); break; } @@ -169,13 +169,13 @@ class CommandObjectSourceList : public CommandObject case 'l': start_line = Args::StringToUInt32 (option_arg, 0); if (start_line == 0) - error.SetErrorStringWithFormat("Invalid line number: '%s'.\n", option_arg); + error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg); break; case 'c': num_lines = Args::StringToUInt32 (option_arg, 0); if (num_lines == 0) - error.SetErrorStringWithFormat("Invalid line count: '%s'.\n", option_arg); + error.SetErrorStringWithFormat("invalid line count: '%s'", option_arg); break; case 'f': @@ -194,7 +194,7 @@ class CommandObjectSourceList : public CommandObject show_bp_locs = true; break; default: - error.SetErrorStringWithFormat("Unrecognized short option '%c'.\n", short_option); + error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index b5c3a4c..89653b7 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1880,7 +1880,7 @@ public: break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } @@ -2644,7 +2644,7 @@ public: if (!success) { Error error; - error.SetErrorStringWithFormat("Invalid address: \"%s\".", option_arg); + error.SetErrorStringWithFormat("invalid address: \"%s\"", option_arg); } } else @@ -2985,13 +2985,13 @@ public: m_type = eLookupTypeAddress; m_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS); if (m_addr == LLDB_INVALID_ADDRESS) - error.SetErrorStringWithFormat ("Invalid address string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid address string '%s'", option_arg); break; case 'o': m_offset = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS); if (m_offset == LLDB_INVALID_ADDRESS) - error.SetErrorStringWithFormat ("Invalid offset string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid offset string '%s'", option_arg); break; case 's': @@ -3011,9 +3011,9 @@ public: case 'l': m_line_number = Args::StringToUInt32(option_arg, UINT32_MAX); if (m_line_number == UINT32_MAX) - error.SetErrorStringWithFormat ("Invalid line number string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid line number string '%s'", option_arg); else if (m_line_number == 0) - error.SetErrorString ("Zero is an invalid line number."); + error.SetErrorString ("zero is an invalid line number"); m_type = eLookupTypeFileLine; break; @@ -3434,7 +3434,7 @@ public: m_line_end = Args::StringToUInt32 (option_arg, UINT_MAX, 0, &success); if (!success) { - error.SetErrorStringWithFormat ("Invalid end line number: \"%s\".", option_arg); + error.SetErrorStringWithFormat ("invalid end line number: \"%s\"", option_arg); break; } m_sym_ctx_specified = true; @@ -3444,7 +3444,7 @@ public: m_line_start = Args::StringToUInt32 (option_arg, 0, 0, &success); if (!success) { - error.SetErrorStringWithFormat ("Invalid start line number: \"%s\".", option_arg); + error.SetErrorStringWithFormat ("invalid start line number: \"%s\"", option_arg); break; } m_sym_ctx_specified = true; @@ -3468,7 +3468,7 @@ public: { m_thread_id = Args::StringToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0); if (m_thread_id == LLDB_INVALID_THREAD_ID) - error.SetErrorStringWithFormat ("Invalid thread id string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg); m_thread_specified = true; } break; @@ -3484,7 +3484,7 @@ public: { m_thread_index = Args::StringToUInt32(option_arg, UINT32_MAX, 0); if (m_thread_id == UINT32_MAX) - error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg); m_thread_specified = true; } break; @@ -3493,7 +3493,7 @@ public: m_one_liner = option_arg; break; default: - error.SetErrorStringWithFormat ("Unrecognized option %c.", short_option); + error.SetErrorStringWithFormat ("unrecognized option %c.", short_option); break; } return error; diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index fde7472..658222e 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -75,7 +75,7 @@ public: bool success; int32_t input_count = Args::StringToSInt32 (option_arg, -1, 0, &success); if (!success) - error.SetErrorStringWithFormat("Invalid integer value for option '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid integer value for option '%c'", short_option); if (input_count < -1) m_count = UINT32_MAX; else @@ -87,11 +87,11 @@ public: bool success; m_start = Args::StringToUInt32 (option_arg, 0, 0, &success); if (!success) - error.SetErrorStringWithFormat("Invalid integer value for option '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid integer value for option '%c'", short_option); } break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } @@ -301,7 +301,7 @@ public: bool success; m_avoid_no_debug = Args::StringToBoolean (option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid boolean value for option '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid boolean value for option '%c'", short_option); } break; @@ -320,7 +320,7 @@ public: break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } @@ -426,7 +426,7 @@ public: uint32_t step_thread_idx = Args::StringToUInt32 (thread_idx_cstr, LLDB_INVALID_INDEX32); if (step_thread_idx == LLDB_INVALID_INDEX32) { - result.AppendErrorWithFormat ("Invalid thread index '%s'.\n", thread_idx_cstr); + result.AppendErrorWithFormat ("invalid thread index '%s'.\n", thread_idx_cstr); result.SetStatus (eReturnStatusFailed); return false; } @@ -789,7 +789,7 @@ public: m_thread_idx = Args::StringToUInt32 (option_arg, LLDB_INVALID_INDEX32); if (m_thread_idx == LLDB_INVALID_INDEX32) { - error.SetErrorStringWithFormat ("Invalid thread index '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid thread index '%s'", option_arg); } } break; @@ -798,7 +798,7 @@ public: m_frame_idx = Args::StringToUInt32 (option_arg, LLDB_INVALID_FRAME_ID); if (m_frame_idx == LLDB_INVALID_FRAME_ID) { - error.SetErrorStringWithFormat ("Invalid frame index '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid frame index '%s'", option_arg); } } break; @@ -817,7 +817,7 @@ public: } break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; } @@ -922,7 +922,7 @@ public: line_number = Args::StringToUInt32 (command.GetArgumentAtIndex(0), UINT32_MAX); if (line_number == UINT32_MAX) { - result.AppendErrorWithFormat ("Invalid line number: '%s'.\n", command.GetArgumentAtIndex(0)); + result.AppendErrorWithFormat ("invalid line number: '%s'.\n", command.GetArgumentAtIndex(0)); result.SetStatus (eReturnStatusFailed); return false; } @@ -1142,7 +1142,7 @@ public: Thread *new_thread = process->GetThreadList().FindThreadByIndexID(index_id).get(); if (new_thread == NULL) { - result.AppendErrorWithFormat ("Invalid thread #%s.\n", command.GetArgumentAtIndex(0)); + result.AppendErrorWithFormat ("invalid thread #%s.\n", command.GetArgumentAtIndex(0)); result.SetStatus (eReturnStatusFailed); return false; } diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index 8acd3e0..b3e24bb 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -237,7 +237,7 @@ private: case 'C': m_cascade = Args::StringToBoolean(option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for cascade: %s.\n", option_arg); + error.SetErrorStringWithFormat("invalid value for cascade: %s", option_arg); break; case 'P': handwrite_python = true; @@ -259,7 +259,7 @@ private: m_regex = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -401,7 +401,7 @@ private: case 'C': m_cascade = Args::StringToBoolean(option_value, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for cascade: %s.\n", option_value); + error.SetErrorStringWithFormat("invalid value for cascade: %s", option_value); break; case 'p': m_skip_pointers = true; @@ -410,7 +410,7 @@ private: m_skip_references = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -937,7 +937,7 @@ CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue (uint32_t option_idx case 'C': m_cascade = Args::StringToBoolean(option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for cascade: %s.\n", option_arg); + error.SetErrorStringWithFormat("invalid value for cascade: %s", option_arg); break; case 'e': m_no_children = false; @@ -978,7 +978,7 @@ CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue (uint32_t option_idx m_category = std::string(option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -1469,7 +1469,7 @@ private: m_category = std::string(option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -1627,7 +1627,7 @@ private: m_delete_all = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -1769,7 +1769,7 @@ class CommandObjectTypeSummaryList : public CommandObject m_category_regex = std::string(option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -2290,7 +2290,7 @@ class CommandObjectTypeFilterList : public CommandObject m_category_regex = std::string(option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -2500,7 +2500,7 @@ class CommandObjectTypeSynthList : public CommandObject m_category_regex = std::string(option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -2698,7 +2698,7 @@ private: m_category = std::string(option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -2860,7 +2860,7 @@ private: m_category = std::string(option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -3020,7 +3020,7 @@ private: m_delete_all = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -3146,7 +3146,7 @@ private: m_delete_all = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -3642,7 +3642,7 @@ private: case 'C': m_cascade = Args::StringToBoolean(option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid value for cascade: %s.\n", option_arg); + error.SetErrorStringWithFormat("invalid value for cascade: %s", option_arg); break; case 'c': m_expr_paths.push_back(option_arg); @@ -3661,7 +3661,7 @@ private: m_regex = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index a6163df..4756e93 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -231,7 +231,7 @@ CommandObjectWatchpointList::CommandOptions::SetOptionValue(uint32_t option_idx, m_level = lldb::eDescriptionLevelVerbose; break; default: - error.SetErrorStringWithFormat("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat("unrecognized option '%c'", short_option); break; } @@ -601,11 +601,11 @@ CommandObjectWatchpointIgnore::CommandOptions::SetOptionValue (uint32_t option_i { m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0); if (m_ignore_count == UINT32_MAX) - error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", option_arg); + error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg); } break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } @@ -741,7 +741,7 @@ CommandObjectWatchpointModify::CommandOptions::SetOptionValue (uint32_t option_i m_condition_passed = true; break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 45c0653..dac85c7 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -2160,7 +2160,7 @@ DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Error err) // Verify we have a value string. if (value == NULL || value[0] == '\0') { - err.SetErrorString ("Missing value. Can't set terminal width without a value.\n"); + err.SetErrorString ("missing value, can't set terminal width without a value"); } else { @@ -2172,10 +2172,10 @@ DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Error err) if (width >= 10 && width <= 1024) valid = true; else - err.SetErrorString ("Invalid term-width value; value must be between 10 and 1024.\n"); + err.SetErrorString ("invalid term-width value; value must be between 10 and 1024"); } else - err.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string.\n", value); + err.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string", value); } return valid; diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index f3a2f0f..d5cf9ab 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -866,14 +866,14 @@ ModuleList::GetSharedModule if (arch.IsValid()) { if (uuid_cstr[0]) - error.SetErrorStringWithFormat("'%s' does not contain the %s architecture and UUID %s.\n", path, arch.GetArchitectureName(), uuid_cstr); + error.SetErrorStringWithFormat("'%s' does not contain the %s architecture and UUID %s", path, arch.GetArchitectureName(), uuid_cstr); else - error.SetErrorStringWithFormat("'%s' does not contain the %s architecture.\n", path, arch.GetArchitectureName()); + error.SetErrorStringWithFormat("'%s' does not contain the %s architecture.", path, arch.GetArchitectureName()); } } else { - error.SetErrorStringWithFormat("'%s' does not exist.\n", path); + error.SetErrorStringWithFormat("'%s' does not exist", path); } return error; } @@ -930,9 +930,9 @@ ModuleList::GetSharedModule if (file_spec) { if (arch.IsValid()) - error.SetErrorStringWithFormat("Unable to open %s architecture in '%s'.\n", arch.GetArchitectureName(), path); + error.SetErrorStringWithFormat("unable to open %s architecture in '%s'", arch.GetArchitectureName(), path); else - error.SetErrorStringWithFormat("Unable to open '%s'.\n", path); + error.SetErrorStringWithFormat("unable to open '%s'", path); } else { @@ -942,9 +942,9 @@ ModuleList::GetSharedModule uuid_cstr[0] = '\0'; if (uuid_cstr[0]) - error.SetErrorStringWithFormat("Cannot locate a module for UUID '%s'.\n", uuid_cstr); + error.SetErrorStringWithFormat("cannot locate a module for UUID '%s'", uuid_cstr); else - error.SetErrorStringWithFormat("Cannot locate a module.\n"); + error.SetErrorStringWithFormat("cannot locate a module"); } } } diff --git a/lldb/source/Core/RegisterValue.cpp b/lldb/source/Core/RegisterValue.cpp index 3dac05c..e3c34fd 100644 --- a/lldb/source/Core/RegisterValue.cpp +++ b/lldb/source/Core/RegisterValue.cpp @@ -392,18 +392,18 @@ RegisterValue::SetValueFromCString (const RegisterInfo *reg_info, const char *va { uint64_t uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 0, &success); if (!success) - error.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string value", value_str); else if (!Args::UInt64ValueIsValidForByteSize (uval64, byte_size)) - error.SetErrorStringWithFormat ("Value 0x%llx is too large to fit in a %u byte unsigned integer value.\n", uval64, byte_size); + error.SetErrorStringWithFormat ("value 0x%llx is too large to fit in a %u byte unsigned integer value", uval64, byte_size); else { if (!SetUInt (uval64, reg_info->byte_size)) - error.SetErrorStringWithFormat ("Unsupported unsigned integer byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported unsigned integer byte size: %u", byte_size); } } else { - error.SetErrorStringWithFormat ("Unsupported unsigned integer byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported unsigned integer byte size: %u", byte_size); return error; } break; @@ -413,18 +413,18 @@ RegisterValue::SetValueFromCString (const RegisterInfo *reg_info, const char *va { uint64_t sval64 = Args::StringToSInt64(value_str, INT64_MAX, 0, &success); if (!success) - error.SetErrorStringWithFormat ("'%s' is not a valid signed integer string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid signed integer string value", value_str); else if (!Args::SInt64ValueIsValidForByteSize (sval64, byte_size)) - error.SetErrorStringWithFormat ("Value 0x%llx is too large to fit in a %u byte signed integer value.\n", sval64, byte_size); + error.SetErrorStringWithFormat ("value 0x%llx is too large to fit in a %u byte signed integer value", sval64, byte_size); else { if (!SetUInt (sval64, reg_info->byte_size)) - error.SetErrorStringWithFormat ("Unsupported signed integer byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported signed integer byte size: %u", byte_size); } } else { - error.SetErrorStringWithFormat ("Unsupported signed integer byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported signed integer byte size: %u", byte_size); return error; } break; @@ -435,31 +435,31 @@ RegisterValue::SetValueFromCString (const RegisterInfo *reg_info, const char *va if (::sscanf (value_str, "%f", &m_data.ieee_float) == 1) m_type = eTypeFloat; else - error.SetErrorStringWithFormat ("'%s' is not a valid float string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); } else if (byte_size == sizeof (double)) { if (::sscanf (value_str, "%lf", &m_data.ieee_double) == 1) m_type = eTypeDouble; else - error.SetErrorStringWithFormat ("'%s' is not a valid float string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); } else if (byte_size == sizeof (long double)) { if (::sscanf (value_str, "%Lf", &m_data.ieee_long_double) == 1) m_type = eTypeLongDouble; else - error.SetErrorStringWithFormat ("'%s' is not a valid float string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); } else { - error.SetErrorStringWithFormat ("Unsupported float byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported float byte size: %u", byte_size); return error; } break; case eEncodingVector: - error.SetErrorString ("Vector encoding unsupported."); + error.SetErrorString ("vector encoding unsupported."); break; } if (error.Fail()) diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp index 70be568..f5ba15f 100644 --- a/lldb/source/Core/Scalar.cpp +++ b/lldb/source/Core/Scalar.cpp @@ -1829,9 +1829,9 @@ Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t { uint64_t uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 0, &success); if (!success) - error.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string value", value_str); else if (!UIntValueIsValidForSize (uval64, byte_size)) - error.SetErrorStringWithFormat ("Value 0x%llx is too large to fit in a %u byte unsigned integer value.\n", uval64, byte_size); + error.SetErrorStringWithFormat ("value 0x%llx is too large to fit in a %u byte unsigned integer value", uval64, byte_size); else { m_type = Scalar::GetValueTypeForUnsignedIntegerWithByteSize (byte_size); @@ -1841,14 +1841,14 @@ Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t case e_ulong: m_data.ulong = uval64; break; case e_ulonglong: m_data.ulonglong = uval64; break; default: - error.SetErrorStringWithFormat ("Unsupported unsigned integer byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported unsigned integer byte size: %u", byte_size); break; } } } else { - error.SetErrorStringWithFormat ("Unsupported unsigned integer byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported unsigned integer byte size: %u", byte_size); return error; } break; @@ -1858,9 +1858,9 @@ Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t { uint64_t sval64 = Args::StringToSInt64(value_str, INT64_MAX, 0, &success); if (!success) - error.SetErrorStringWithFormat ("'%s' is not a valid signed integer string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid signed integer string value", value_str); else if (!SIntValueIsValidForSize (sval64, byte_size)) - error.SetErrorStringWithFormat ("Value 0x%llx is too large to fit in a %u byte signed integer value.\n", sval64, byte_size); + error.SetErrorStringWithFormat ("value 0x%llx is too large to fit in a %u byte signed integer value", sval64, byte_size); else { m_type = Scalar::GetValueTypeForSignedIntegerWithByteSize (byte_size); @@ -1870,14 +1870,14 @@ Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t case e_slong: m_data.slong = sval64; break; case e_slonglong: m_data.slonglong = sval64; break; default: - error.SetErrorStringWithFormat ("Unsupported signed integer byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported signed integer byte size: %u", byte_size); break; } } } else { - error.SetErrorStringWithFormat ("Unsupported signed integer byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported signed integer byte size: %u", byte_size); return error; } break; @@ -1888,31 +1888,31 @@ Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t if (::sscanf (value_str, "%f", &m_data.flt) == 1) m_type = e_float; else - error.SetErrorStringWithFormat ("'%s' is not a valid float string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); } else if (byte_size == sizeof (double)) { if (::sscanf (value_str, "%lf", &m_data.dbl) == 1) m_type = e_double; else - error.SetErrorStringWithFormat ("'%s' is not a valid float string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); } else if (byte_size == sizeof (long double)) { if (::sscanf (value_str, "%Lf", &m_data.ldbl) == 1) m_type = e_long_double; else - error.SetErrorStringWithFormat ("'%s' is not a valid float string value.\n", value_str); + error.SetErrorStringWithFormat ("'%s' is not a valid float string value", value_str); } else { - error.SetErrorStringWithFormat ("Unsupported float byte size: %u.\n", byte_size); + error.SetErrorStringWithFormat ("unsupported float byte size: %u", byte_size); return error; } break; case eEncodingVector: - error.SetErrorString ("Vector encoding unsupported."); + error.SetErrorString ("vector encoding unsupported."); break; } if (error.Fail()) diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index a33b915..91e4f0b 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -285,7 +285,7 @@ UserSettingsController::SetVariable (const char *full_dot_name, if (num_pieces < 1) { - err.SetErrorStringWithFormat ("'%s' is not a valid variable name; cannot assign value.\n", full_dot_name); + err.SetErrorStringWithFormat ("'%s' is not a valid variable name; cannot assign value", full_dot_name); return err; } @@ -303,7 +303,7 @@ UserSettingsController::SetVariable (const char *full_dot_name, if (num_pieces == 0) { - err.SetErrorString ("No variable name specified; cannot assign value.\n"); + err.SetErrorString ("no variable name specified, cannot assign value"); return err; } else if (num_pieces == 1) @@ -337,7 +337,7 @@ UserSettingsController::SetVariable (const char *full_dot_name, entry = GetInstanceEntry (const_var_name); if (entry == NULL) { - err.SetErrorStringWithFormat ("Unable to find variable '%s.%s'; cannot assign value.\n", + err.SetErrorStringWithFormat ("unable to find variable '%s.%s', cannot assign value", prefix.GetCString(), const_var_name.GetCString()); return err; } @@ -412,7 +412,7 @@ UserSettingsController::SetVariable (const char *full_dot_name, if (names.GetArgumentCount() != 1) { - err.SetErrorStringWithFormat ("Invalid variable name format '%s'; cannot assign value.\n", + err.SetErrorStringWithFormat ("invalid variable name format '%s', cannot assign value", full_dot_name); return err; } @@ -424,7 +424,7 @@ UserSettingsController::SetVariable (const char *full_dot_name, if (entry == NULL) { - err.SetErrorStringWithFormat ("Unknown instance variable '%s'; cannot assign value.\n", + err.SetErrorStringWithFormat ("unknown instance variable '%s', cannot assign value", const_var_name.GetCString()); return err; } @@ -513,7 +513,7 @@ UserSettingsController::SetVariable (const char *full_dot_name, } if (!found) { - err.SetErrorStringWithFormat ("Unable to find variable '%s'; cannot assign value.\n", + err.SetErrorStringWithFormat ("unable to find variable '%s', cannot assign value", full_dot_name); return err; } @@ -522,7 +522,7 @@ UserSettingsController::SetVariable (const char *full_dot_name, } else { - err.SetErrorStringWithFormat ("'%s' is not a valid level name; was expecting '%s'. Cannot assign value.\n", + err.SetErrorStringWithFormat ("'%s' is not a valid level name; was expecting '%s', cannot assign value", prefix.GetCString(), m_settings.level_name.GetCString()); } @@ -553,7 +553,7 @@ UserSettingsController::GetVariable if ((prefix != m_settings.level_name) && (m_settings.level_name.GetLength () > 0)) { - err.SetErrorString ("Invalid variable name"); + err.SetErrorString ("invalid variable name"); return value; } @@ -638,7 +638,7 @@ UserSettingsController::GetVariable } } else - err.SetErrorString ("Invalid variable name"); + err.SetErrorString ("invalid variable name"); } } else @@ -647,7 +647,7 @@ UserSettingsController::GetVariable if ((global_entry == NULL) && (instance_entry == NULL)) { - err.SetErrorString ("Invalid variable name"); + err.SetErrorString ("invalid variable name"); } else if (global_entry) { @@ -1139,7 +1139,7 @@ UserSettingsController::FindSettingsDescriptions (CommandInterpreter &interprete { std::string parent_prefix; usc_sp->BuildParentPrefix (parent_prefix); - err.SetErrorStringWithFormat ("Cannot find match for '%s.%s'\n", parent_prefix.c_str(), + err.SetErrorStringWithFormat ("cannot find match for '%s.%s'", parent_prefix.c_str(), prefix.GetCString()); return; } @@ -1227,7 +1227,7 @@ UserSettingsController::FindSettingsDescriptions (CommandInterpreter &interprete { std::string parent_prefix; usc_sp->BuildParentPrefix (parent_prefix); - err.SetErrorStringWithFormat ("Cannot find match for '%s.%s'\n", parent_prefix.c_str(), search_name); + err.SetErrorStringWithFormat ("cannot find match for '%s.%s'", parent_prefix.c_str(), search_name); return; } } @@ -1266,7 +1266,7 @@ UserSettingsController::FindSettingsDescriptions (CommandInterpreter &interprete { std::string parent_prefix; usc_sp->BuildParentPrefix (parent_prefix); - err.SetErrorStringWithFormat ("Cannot find match for '%s.%s'\n", parent_prefix.c_str(), search_name); + err.SetErrorStringWithFormat ("cannot find match for '%s.%s'", parent_prefix.c_str(), search_name); return; } } @@ -1976,7 +1976,7 @@ UserSettingsController::VerifyOperationForType (SettableVariableType var_type, if (op == eVarSetOperationInvalid) { - err.SetErrorString ("Invalid 'settings ' subcommand operation.\n"); + err.SetErrorString ("invalid 'settings' subcommand operation"); return; } @@ -1985,22 +1985,20 @@ UserSettingsController::VerifyOperationForType (SettableVariableType var_type, case eVarSetOperationInsertBefore: case eVarSetOperationInsertAfter: if (var_type != eSetVarTypeArray) - err.SetErrorString ("Invalid operation: This operation can only be performed on array variables.\n"); + err.SetErrorString ("invalid operation: this operation can only be performed on array variables"); break; case eVarSetOperationReplace: case eVarSetOperationRemove: if ((var_type != eSetVarTypeArray) && (var_type != eSetVarTypeDictionary)) - err.SetErrorString ("Invalid operation: This operation can only be performed on array or dictionary" - " variables.\n"); + err.SetErrorString ("invalid operation: this operation can only be performed on array or dictionary variables"); break; case eVarSetOperationAppend: case eVarSetOperationClear: if ((var_type != eSetVarTypeArray) && (var_type != eSetVarTypeDictionary) && (var_type != eSetVarTypeString)) - err.SetErrorString ("Invalid operation: This operation can only be performed on array, dictionary " - "or string variables.\n"); + err.SetErrorString ("invalid operation: this operation can only be performed on array, dictionary or string variables"); break; default: break; @@ -2030,7 +2028,7 @@ UserSettingsController::UpdateStringVariable (VarSetOperationType op, else if (op == eVarSetOperationClear) string_var.clear(); else - err.SetErrorString ("Unrecognized operation. Cannot update value.\n"); + err.SetErrorString ("unrecognized operation. Cannot update value"); } Error @@ -2053,7 +2051,7 @@ UserSettingsController::UpdateStringOptionValue (const char *value, } else { - error.SetErrorString ("Unrecognized operation. Cannot update value.\n"); + error.SetErrorString ("unrecognized operation, cannot update value"); } return error; } @@ -2118,7 +2116,7 @@ UserSettingsController::UpdateBooleanVariable (VarSetOperationType op, case eVarSetOperationAppend: case eVarSetOperationInvalid: default: - err.SetErrorString ("Invalid operation for Boolean variable. Cannot update value.\n"); + err.SetErrorString ("invalid operation for Boolean variable, cannot update value"); break; case eVarSetOperationClear: @@ -2132,9 +2130,9 @@ UserSettingsController::UpdateBooleanVariable (VarSetOperationType op, if (value_cstr == NULL) - err.SetErrorStringWithFormat ("invalid boolean string value (NULL)\n"); + err.SetErrorStringWithFormat ("invalid boolean string value (NULL)"); else if (value_cstr[0] == '\0') - err.SetErrorStringWithFormat ("invalid boolean string value (empty)\n"); + err.SetErrorStringWithFormat ("invalid boolean string value (empty)"); else { bool new_value = Args::StringToBoolean (value_cstr, false, &success); @@ -2144,7 +2142,7 @@ UserSettingsController::UpdateBooleanVariable (VarSetOperationType op, bool_value = new_value; } else - err.SetErrorStringWithFormat ("invalid boolean string value: '%s'\n", value_cstr); + err.SetErrorStringWithFormat ("invalid boolean string value: '%s'", value_cstr); } } break; @@ -2214,7 +2212,7 @@ UserSettingsController::UpdateStringArrayVariable (VarSetOperationType op, if (!isdigit (index_value[i])) { valid_index = false; - err.SetErrorStringWithFormat ("'%s' is not a valid integer index. Cannot update array value.\n", + err.SetErrorStringWithFormat ("'%s' is not a valid integer index, cannot update array value", index_value); } @@ -2225,8 +2223,8 @@ UserSettingsController::UpdateStringArrayVariable (VarSetOperationType op, || index >= array_var.GetArgumentCount()) { valid_index = false; - err.SetErrorStringWithFormat ("%d is outside the bounds of the specified array variable. " - "Cannot update array value.\n", index); + err.SetErrorStringWithFormat ("%d is outside the bounds of the specified array variable, " + "cannot update array value", index); } } @@ -2270,7 +2268,7 @@ UserSettingsController::UpdateStringArrayVariable (VarSetOperationType op, array_var.Clear(); break; default: - err.SetErrorString ("Unrecognized operation. Cannot update value.\n"); + err.SetErrorString ("unrecognized operation, cannot update value"); break; } } @@ -2294,10 +2292,10 @@ UserSettingsController::UpdateDictionaryVariable (VarSetOperationType op, if (pos != dictionary.end()) dictionary[key] = new_value; else - err.SetErrorStringWithFormat ("'%s' is not an existing key; cannot replace value.\n", index_value); + err.SetErrorStringWithFormat ("'%s' is not an existing key; cannot replace value", index_value); } else - err.SetErrorString ("'settings replace' requires a key for dictionary variables. No key supplied.\n"); + err.SetErrorString ("'settings replace' requires a key for dictionary variables, no key supplied"); break; case eVarSetOperationRemove: if (index_value != NULL) @@ -2306,7 +2304,7 @@ UserSettingsController::UpdateDictionaryVariable (VarSetOperationType op, dictionary.erase (key); } else - err.SetErrorString ("'settings remove' requires a key for dictionary variables. No key supplied.\n"); + err.SetErrorString ("'settings remove' requires a key for dictionary variables, no key supplied"); break; case eVarSetOperationClear: dictionary.clear (); @@ -2346,17 +2344,17 @@ UserSettingsController::UpdateDictionaryVariable (VarSetOperationType op, } else { - err.SetErrorString ("Invalid format for dictionary value. Expected one of '[\"<key>\"]=<value>', '[<key>]=<value>', or '<key>=<value>'\n"); + err.SetErrorString ("invalid format for dictionary value, expected one of '[\"<key>\"]=<value>', '[<key>]=<value>', or '<key>=<value>'"); } } } break; case eVarSetOperationInsertBefore: case eVarSetOperationInsertAfter: - err.SetErrorString ("Specified operation cannot be performed on dictionary variables.\n"); + err.SetErrorString ("specified operation cannot be performed on dictionary variables"); break; default: - err.SetErrorString ("Unrecognized operation.\n"); + err.SetErrorString ("unrecognized operation"); break; } } diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index b07b38c..92532a3 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -179,7 +179,7 @@ ValueObjectChild::UpdateValue () // extract the child value from within the parent data? // Probably... default: - m_error.SetErrorString ("Parent has invalid value."); + m_error.SetErrorString ("parent has invalid value."); break; } } @@ -192,7 +192,7 @@ ValueObjectChild::UpdateValue () } else { - m_error.SetErrorStringWithFormat("Parent failed to evaluate: %s.\n", parent->GetError().AsCString()); + m_error.SetErrorStringWithFormat("parent failed to evaluate: %s", parent->GetError().AsCString()); } } else diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index fefa343..a12cd3a 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -276,7 +276,7 @@ File::GetFileSpec (FileSpec &file_spec) const char proc[64]; char path[PATH_MAX]; if (::snprintf(proc, sizeof(proc), "/proc/self/fd/%d", GetDescriptor()) < 0) - error.SetErrorString ("Cannot resolve file descriptor\n"); + error.SetErrorString ("cannot resolve file descriptor"); else { ssize_t len; diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp index 7205cb6..592b0ef 100644 --- a/lldb/source/Interpreter/Args.cpp +++ b/lldb/source/Interpreter/Args.cpp @@ -584,7 +584,7 @@ Args::ParseOptions (Options &options) struct option *long_options = options.GetLongOptions(); if (long_options == NULL) { - error.SetErrorStringWithFormat("Invalid long options.\n"); + error.SetErrorStringWithFormat("invalid long options"); return error; } @@ -620,7 +620,7 @@ Args::ParseOptions (Options &options) // Did we get an error? if (val == '?') { - error.SetErrorStringWithFormat("Unknown or ambiguous option.\n"); + error.SetErrorStringWithFormat("unknown or ambiguous option"); break; } // The option auto-set itself @@ -651,7 +651,7 @@ Args::ParseOptions (Options &options) } else { - error.SetErrorStringWithFormat("Invalid option with value '%i'.\n", val); + error.SetErrorStringWithFormat("invalid option with value '%i'", val); } if (error.Fail()) break; @@ -940,7 +940,7 @@ Args::StringToFormat } else { - error.SetErrorStringWithFormat("%s option string.\n", s ? "empty" : "invalid"); + error.SetErrorStringWithFormat("%s option string", s ? "empty" : "invalid"); } return error; } diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 2d3a6b7..203a47e 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -207,7 +207,7 @@ CommandObject::ParseOptions if (error_cstr) { // We got an error string, lets use that - result.GetErrorStream().PutCString(error_cstr); + result.AppendError(error_cstr); } else { @@ -640,16 +640,47 @@ CommandObject::LookupArgumentName (const char *arg_name) static const char * BreakpointIDHelpTextCallback () { - return "Breakpoint ID's consist major and minor numbers; the major number corresponds to the single entity that was created with a 'breakpoint set' command; the minor numbers correspond to all the locations that were actually found/set based on the major breakpoint. A full breakpoint ID might look like 3.14, meaning the 14th location set for the 3rd breakpoint. You can specify all the locations of a breakpoint by just indicating the major breakpoint number. A valid breakpoint id consists either of just the major id number, or the major number, a dot, and the location number (e.g. 3 or 3.2 could both be valid breakpoint ids)."; + return "Breakpoint ID's consist major and minor numbers; the major number " + "corresponds to the single entity that was created with a 'breakpoint set' " + "command; the minor numbers correspond to all the locations that were actually " + "found/set based on the major breakpoint. A full breakpoint ID might look like " + "3.14, meaning the 14th location set for the 3rd breakpoint. You can specify " + "all the locations of a breakpoint by just indicating the major breakpoint " + "number. A valid breakpoint id consists either of just the major id number, " + "or the major number, a dot, and the location number (e.g. 3 or 3.2 could " + "both be valid breakpoint ids)."; } static const char * BreakpointIDRangeHelpTextCallback () { - return "A 'breakpoint id list' is a manner of specifying multiple breakpoints. This can be done through several mechanisms. The easiest way is to just enter a space-separated list of breakpoint ids. To specify all the breakpoint locations under a major breakpoint, you can use the major breakpoint number followed by '.*', eg. '5.*' means all the locations under breakpoint 5. You can also indicate a range of breakpoints by using <start-bp-id> - <end-bp-id>. The start-bp-id and end-bp-id for a range can be any valid breakpoint ids. It is not legal, however, to specify a range using specific locations that cross major breakpoint numbers. I.e. 3.2 - 3.7 is legal; 2 - 5 is legal; but 3.2 - 4.4 is not legal."; + return "A 'breakpoint id list' is a manner of specifying multiple breakpoints. " + "This can be done through several mechanisms. The easiest way is to just " + "enter a space-separated list of breakpoint ids. To specify all the " + "breakpoint locations under a major breakpoint, you can use the major " + "breakpoint number followed by '.*', eg. '5.*' means all the locations under " + "breakpoint 5. You can also indicate a range of breakpoints by using " + "<start-bp-id> - <end-bp-id>. The start-bp-id and end-bp-id for a range can " + "be any valid breakpoint ids. It is not legal, however, to specify a range " + "using specific locations that cross major breakpoint numbers. I.e. 3.2 - 3.7" + " is legal; 2 - 5 is legal; but 3.2 - 4.4 is not legal."; } static const char * +GDBFormatHelpTextCallback () +{ + return "A GDB format consists of a repeat count followed by a format letter " + "and a size letter.\n\nFormat letters are o (octal), x (hex), d (decimal), u" + " (unsigned decimal), t (binary), f (float), a (address), i (instruction), " + "c (char) and s (string), T (OSType), A (floating point values in hex).\n\n" + "Size letters are b (byte), h (halfword), w (word), g (giant, 8 bytes).\n\n" + "The specified number of objects of the specified size are printed " + "according to the format.\n\n" + "Defaults for format and size letters are those previously used. Default " + "count is 1."; +} + +static const char * FormatHelpTextCallback () { @@ -803,6 +834,7 @@ CommandObject::g_arguments_data[] = { eArgTypeFrameIndex, "frame-index", CommandCompletions::eNoCompletion, { NULL, false }, "Index into a thread's list of frames." }, { eArgTypeFullName, "fullname", CommandCompletions::eNoCompletion, { NULL, false }, "Help text goes here." }, { eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, { NULL, false }, "The name of a function." }, + { eArgTypeGDBFormat, "gdb-format", CommandCompletions::eNoCompletion, { GDBFormatHelpTextCallback, true }, NULL }, { eArgTypeIndex, "index", CommandCompletions::eNoCompletion, { NULL, false }, "An index into a list." }, { eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, { NULL, false }, "Line number in a source file." }, { eArgTypeLogCategory, "log-category", CommandCompletions::eNoCompletion, { NULL, false }, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." }, diff --git a/lldb/source/Interpreter/NamedOptionValue.cpp b/lldb/source/Interpreter/NamedOptionValue.cpp index f4c0e34..33753b9 100644 --- a/lldb/source/Interpreter/NamedOptionValue.cpp +++ b/lldb/source/Interpreter/NamedOptionValue.cpp @@ -189,11 +189,11 @@ OptionValueBoolean::SetValueFromCString (const char *value_cstr) else { if (value_cstr == NULL) - error.SetErrorString ("invalid boolean string value: NULL\n"); + error.SetErrorString ("invalid boolean string value: NULL"); else if (value_cstr[0] == '\0') - error.SetErrorString ("invalid boolean string value <empty>\n"); + error.SetErrorString ("invalid boolean string value <empty>"); else - error.SetErrorStringWithFormat ("invalid boolean string value: '%s'\n", value_cstr); + error.SetErrorStringWithFormat ("invalid boolean string value: '%s'", value_cstr); } return error; } @@ -221,7 +221,7 @@ OptionValueSInt64::SetValueFromCString (const char *value_cstr) } else { - error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'\n", value_cstr); + error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'", value_cstr); } return error; } @@ -260,7 +260,7 @@ OptionValueUInt64::SetValueFromCString (const char *value_cstr) } else { - error.SetErrorStringWithFormat ("invalid uint64_t string value: '%s'\n", value_cstr); + error.SetErrorStringWithFormat ("invalid uint64_t string value: '%s'", value_cstr); } return error; } @@ -396,7 +396,7 @@ Error OptionValueArray::SetValueFromCString (const char *value_cstr) { Error error; - error.SetErrorStringWithFormat ("array option values don't yet support being set by string: '%s'\n", value_cstr); + error.SetErrorStringWithFormat ("array option values don't yet support being set by string: '%s'", value_cstr); return error; } @@ -419,7 +419,7 @@ Error OptionValueDictionary::SetValueFromCString (const char *value_cstr) { Error error; - error.SetErrorStringWithFormat ("dictionary option values don't yet support being set by string: '%s'\n", value_cstr); + error.SetErrorStringWithFormat ("dictionary option values don't yet support being set by string: '%s'", value_cstr); return error; } diff --git a/lldb/source/Interpreter/OptionGroupArchitecture.cpp b/lldb/source/Interpreter/OptionGroupArchitecture.cpp index 377bac0..a94d1fc 100644 --- a/lldb/source/Interpreter/OptionGroupArchitecture.cpp +++ b/lldb/source/Interpreter/OptionGroupArchitecture.cpp @@ -71,7 +71,7 @@ OptionGroupArchitecture::SetOptionValue (CommandInterpreter &interpreter, break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Interpreter/OptionGroupFormat.cpp b/lldb/source/Interpreter/OptionGroupFormat.cpp index ad4f371..7dc8154 100644 --- a/lldb/source/Interpreter/OptionGroupFormat.cpp +++ b/lldb/source/Interpreter/OptionGroupFormat.cpp @@ -23,7 +23,9 @@ OptionGroupFormat::OptionGroupFormat (lldb::Format default_format, uint64_t default_count) : m_format (default_format, default_format), m_byte_size (default_byte_size, default_byte_size), - m_count (default_count, default_count) + m_count (default_count, default_count), + m_prev_gdb_format('x'), + m_prev_gdb_size('w') { } @@ -34,9 +36,12 @@ OptionGroupFormat::~OptionGroupFormat () static OptionDefinition g_option_table[] = { -{ LLDB_OPT_SET_1, false, "format",'f', required_argument, NULL, 0, eArgTypeFormat , "Specify a format to be used for display."}, -{ LLDB_OPT_SET_2, false, "size" ,'s', required_argument, NULL, 0, eArgTypeByteSize, "The size in bytes to use when displaying with the selected format."}, -{ LLDB_OPT_SET_3, false, "count" ,'c', required_argument, NULL, 0, eArgTypeCount , "The number of total items to display."}, +{ LLDB_OPT_SET_1, false, "format" ,'f', required_argument, NULL, 0, eArgTypeFormat , "Specify a format to be used for display."}, +{ LLDB_OPT_SET_1| + LLDB_OPT_SET_2| + LLDB_OPT_SET_3, false, "gdb-format",'G', required_argument, NULL, 0, eArgTypeGDBFormat, "Specify a format using a GDB format specifier string."}, +{ LLDB_OPT_SET_2, false, "size" ,'s', required_argument, NULL, 0, eArgTypeByteSize , "The size in bytes to use when displaying with the selected format."}, +{ LLDB_OPT_SET_3, false, "count" ,'c', required_argument, NULL, 0, eArgTypeCount , "The number of total items to display."}, }; uint32_t @@ -45,11 +50,11 @@ OptionGroupFormat::GetNumDefinitions () if (m_byte_size.GetDefaultValue() < UINT64_MAX) { if (m_count.GetDefaultValue() < UINT64_MAX) - return 3; + return 4; else - return 2; + return 3; } - return 1; + return 2; } const OptionDefinition * @@ -98,14 +103,159 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter, } break; + case 'G': + { + char *end = NULL; + const char *gdb_format_cstr = option_arg; + uint64_t count = 0; + if (::isdigit (gdb_format_cstr[0])) + { + count = strtoull (gdb_format_cstr, &end, 0); + + if (option_arg != end) + gdb_format_cstr = end; // We have a valid count, advance the string position + else + count = 0; + } + + Format format = SetFormatUsingGDBFormatLetter (gdb_format_cstr[0]); + if (format != eFormatInvalid) + ++gdb_format_cstr; + + uint32_t byte_size = SetByteSizeUsingGDBSizeLetter (gdb_format_cstr[0]); + if (byte_size == 0) + ++gdb_format_cstr; + + // We the first character of the "gdb_format_cstr" is not the + // NULL terminator, we didn't consume the entire string and + // something is wrong. Also, if none of the format, size or count + // was specified correctly, then abort. + if (gdb_format_cstr[0] || (format == eFormatInvalid && byte_size == 0 && count == 0)) + { + // Nothing got set correctly + error.SetErrorStringWithFormat ("invalid gdb format string '%s'", option_arg); + return error; + } + + // At least one of the format, size or count was set correctly. + // Anything that wasn't set correctly should be set to the + // previous default + if (format == eFormatInvalid) + format = SetFormatUsingGDBFormatLetter (m_prev_gdb_format); + + const bool byte_size_enabled = m_byte_size.GetDefaultValue() < UINT64_MAX; + const bool count_enabled = m_count.GetDefaultValue() < UINT64_MAX; + if (byte_size_enabled) + { + // Byte size is enabled + if (byte_size == 0) + byte_size = SetByteSizeUsingGDBSizeLetter (m_prev_gdb_size); + } + else + { + // Byte size is disabled, make sure it wasn't specified + if (byte_size > 0) + { + error.SetErrorString ("this command doesn't support specifying a byte size"); + return error; + } + } + + if (count_enabled) + { + // Count is enabled and was not set, set it to the default + if (count == 0) + count = m_count.GetDefaultValue(); + } + else + { + // Count is disabled, make sure it wasn't specified + if (count > 0) + { + error.SetErrorString ("this command doesn't support specifying a count"); + return error; + } + } + + m_format.SetCurrentValue (format); + m_format.SetOptionWasSet (); + if (byte_size_enabled) + { + m_byte_size.SetCurrentValue (byte_size); + m_byte_size.SetOptionWasSet (); + } + if (count_enabled) + { + m_count.SetCurrentValue(count); + m_count.SetOptionWasSet (); + } + } + break; + default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } return error; } +Format +OptionGroupFormat::SetFormatUsingGDBFormatLetter (char format_letter) +{ + Format format = eFormatInvalid; + switch (format_letter) + { + case 'o': format = eFormatOctal; break; + case 'x': format = eFormatHex; break; + case 'd': format = eFormatDecimal; break; + case 'u': format = eFormatUnsigned; break; + case 't': format = eFormatBinary; break; + case 'f': format = eFormatFloat; break; + case 'a': format = eFormatHex; break; // TODO: add a new format: eFormatAddress + case 'i': format = eFormatHex; break; // TODO: add a new format: eFormatInstruction + case 'c': format = eFormatChar; break; + case 's': format = eFormatCString; break; + case 'T': format = eFormatOSType; break; + case 'A': format = eFormatHex; break; // TODO: add a new format: eFormatHexFloat + default: break; + } + if (format != eFormatInvalid) + m_prev_gdb_format = format_letter; + return format; +} + +uint32_t +OptionGroupFormat::SetByteSizeUsingGDBSizeLetter (char size_letter) +{ + uint32_t byte_size = 0; + switch (size_letter) + { + case 'b': // byte + byte_size = 1; + break; + + case 'h': // halfword + byte_size = 2; + break; + + case 'w': // word + byte_size = 4; + break; + + case 'g': // giant + byte_size = 8; + break; + + default: + break; + } + if (byte_size) + m_prev_gdb_size = size_letter; + return byte_size; +} + + void OptionGroupFormat::OptionParsingStarting (CommandInterpreter &interpreter) { diff --git a/lldb/source/Interpreter/OptionGroupOutputFile.cpp b/lldb/source/Interpreter/OptionGroupOutputFile.cpp index f5daa3a5..9c8eb94 100644 --- a/lldb/source/Interpreter/OptionGroupOutputFile.cpp +++ b/lldb/source/Interpreter/OptionGroupOutputFile.cpp @@ -66,7 +66,7 @@ OptionGroupOutputFile::SetOptionValue (CommandInterpreter &interpreter, break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp index e65ee8c..4e54c39 100644 --- a/lldb/source/Interpreter/OptionGroupPlatform.cpp +++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp @@ -119,7 +119,7 @@ OptionGroupPlatform::SetOptionValue (CommandInterpreter &interpreter, break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } return error; diff --git a/lldb/source/Interpreter/OptionGroupUUID.cpp b/lldb/source/Interpreter/OptionGroupUUID.cpp index c8f86c2..d4ae9e9 100644 --- a/lldb/source/Interpreter/OptionGroupUUID.cpp +++ b/lldb/source/Interpreter/OptionGroupUUID.cpp @@ -62,7 +62,7 @@ OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter, break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp index bda9b68..ae4116f 100644 --- a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp +++ b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp @@ -88,13 +88,13 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter, case 'D': max_depth = Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success); if (!success) - error.SetErrorStringWithFormat("Invalid max depth '%s'.\n", option_arg); + error.SetErrorStringWithFormat("invalid max depth '%s'", option_arg); break; case 'P': ptr_depth = Args::StringToUInt32 (option_arg, 0, 0, &success); if (!success) - error.SetErrorStringWithFormat("Invalid pointer depth '%s'.\n", option_arg); + error.SetErrorStringWithFormat("invalid pointer depth '%s'", option_arg); break; case 'Y': @@ -102,7 +102,7 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter, { no_summary_depth = Args::StringToUInt32 (option_arg, 0, 0, &success); if (!success) - error.SetErrorStringWithFormat("Invalid pointer depth '%s'.\n", option_arg); + error.SetErrorStringWithFormat("invalid pointer depth '%s'", option_arg); } else no_summary_depth = 1; @@ -111,10 +111,10 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter, case 'S': use_synth = Args::StringToBoolean(option_arg, true, &success); if (!success) - error.SetErrorStringWithFormat("Invalid synthetic-type '%s'.\n", option_arg); + error.SetErrorStringWithFormat("invalid synthetic-type '%s'", option_arg); break; default: - error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option); break; } diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp index 9e9de7d..ee5aa3b 100644 --- a/lldb/source/Interpreter/OptionGroupVariable.cpp +++ b/lldb/source/Interpreter/OptionGroupVariable.cpp @@ -67,7 +67,7 @@ OptionGroupVariable::SetOptionValue (CommandInterpreter &interpreter, summary = std::string(option_arg); break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option); break; } diff --git a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp index 27c3d45..159d00e 100644 --- a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp +++ b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp @@ -74,7 +74,7 @@ OptionGroupWatchpoint::SetOptionValue (CommandInterpreter &interpreter, break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option); break; } diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 01c0fb8..484fe54 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -331,7 +331,7 @@ PlatformRemoteGDBServer::LaunchProcess (ProcessLaunchInfo &launch_info) } else { - error.SetErrorStringWithFormat("'A' packet returned an error: %i.\n", arg_packet_err); + error.SetErrorStringWithFormat("'A' packet returned an error: %i", arg_packet_err); } return error; } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index e7fcb92..6ea0cd5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -526,7 +526,7 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *debugserver_url, } else { - error.SetErrorStringWithFormat ("Unable to locate " DEBUGSERVER_BASENAME ".\n"); + error.SetErrorStringWithFormat ("unable to locate " DEBUGSERVER_BASENAME ); } return error; } diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 2c50b6e..917fc4d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -563,7 +563,7 @@ ProcessGDBRemote::DoLaunch } else { - error.SetErrorStringWithFormat("'A' packet returned an error: %i.\n", arg_packet_err); + error.SetErrorStringWithFormat("'A' packet returned an error: %i", arg_packet_err); } m_gdb_comm.SetPacketTimeout (old_packet_timeout); @@ -597,7 +597,7 @@ ProcessGDBRemote::DoLaunch { // Set our user ID to an invalid process ID. SetID(LLDB_INVALID_PROCESS_ID); - error.SetErrorStringWithFormat("Failed to get object file from '%s' for arch %s.\n", + error.SetErrorStringWithFormat("failed to get object file from '%s' for arch %s", module->GetFileSpec().GetFilename().AsCString(), module->GetArchitecture().GetArchitectureName()); } @@ -2166,7 +2166,7 @@ ProcessGDBRemote::StartDebugserverProcess (const char *debugserver_url) // Th } else { - error.SetErrorStringWithFormat ("Unable to locate " DEBUGSERVER_BASENAME ".\n"); + error.SetErrorStringWithFormat ("unable to locate " DEBUGSERVER_BASENAME); } if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID) diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 9a3020a..671084d 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -420,7 +420,7 @@ ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *op break; default: - error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option); + error.SetErrorStringWithFormat("unrecognized short option character '%c'", short_option); break; } @@ -1481,7 +1481,7 @@ Process::EnableSoftwareBreakpoint (BreakpointSite *bp_site) if (bp_opcode_size == 0) { - error.SetErrorStringWithFormat ("Process::GetSoftwareBreakpointTrapOpcode() returned zero, unable to get breakpoint trap for address 0x%llx.\n", bp_addr); + error.SetErrorStringWithFormat ("Process::GetSoftwareBreakpointTrapOpcode() returned zero, unable to get breakpoint trap for address 0x%llx", bp_addr); } else { @@ -1512,7 +1512,7 @@ Process::EnableSoftwareBreakpoint (BreakpointSite *bp_site) (uint64_t)bp_addr); } else - error.SetErrorString("Failed to verify the breakpoint trap in memory."); + error.SetErrorString("failed to verify the breakpoint trap in memory."); } else error.SetErrorString("Unable to read memory to verify breakpoint trap."); @@ -2161,7 +2161,7 @@ Process::Launch } else { - error.SetErrorStringWithFormat("File doesn't exist: '%s'.\n", local_exec_file_path); + error.SetErrorStringWithFormat("file doesn't exist: '%s'", local_exec_file_path); } } return error; @@ -2272,16 +2272,16 @@ Process::Attach (const char *process_name, bool wait_for_launch) platform_sp->FindProcesses (match_info, process_infos); if (process_infos.GetSize() > 1) { - error.SetErrorStringWithFormat ("More than one process named %s\n", process_name); + error.SetErrorStringWithFormat ("more than one process named %s", process_name); } else if (process_infos.GetSize() == 0) { - error.SetErrorStringWithFormat ("Could not find a process named %s\n", process_name); + error.SetErrorStringWithFormat ("could not find a process named %s", process_name); } } else { - error.SetErrorString ("Invalid platform"); + error.SetErrorString ("invalid platform"); } } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 359435d..dbfee31 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -1022,12 +1022,12 @@ Target::ReadMemory (const Address& addr, if (load_addr == LLDB_INVALID_ADDRESS) { if (resolved_addr.GetModule() && resolved_addr.GetModule()->GetFileSpec()) - error.SetErrorStringWithFormat("%s[0x%llx] can't be resolved, %s in not currently loaded.\n", + error.SetErrorStringWithFormat("%s[0x%llx] can't be resolved, %s in not currently loaded", resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString(), resolved_addr.GetFileAddress(), resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString()); else - error.SetErrorStringWithFormat("0x%llx can't be resolved.\n", resolved_addr.GetFileAddress()); + error.SetErrorStringWithFormat("0x%llx can't be resolved", resolved_addr.GetFileAddress()); } else { @@ -1037,9 +1037,9 @@ Target::ReadMemory (const Address& addr, if (error.Success()) { if (bytes_read == 0) - error.SetErrorStringWithFormat("Read memory from 0x%llx failed.\n", load_addr); + error.SetErrorStringWithFormat("read memory from 0x%llx failed", load_addr); else - error.SetErrorStringWithFormat("Only %zu of %zu bytes were read from memory at 0x%llx.\n", bytes_read, dst_len, load_addr); + error.SetErrorStringWithFormat("only %zu of %zu bytes were read from memory at 0x%llx", bytes_read, dst_len, load_addr); } } if (bytes_read) @@ -2115,7 +2115,7 @@ TargetInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_n if (!m_expr_prefix_file.GetCurrentValue().Exists()) { err.SetErrorToGenericError (); - err.SetErrorStringWithFormat ("%s does not exist.\n", value); + err.SetErrorStringWithFormat ("%s does not exist", value); return; } @@ -2123,7 +2123,7 @@ TargetInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_n if (!m_expr_prefix_contents_sp && m_expr_prefix_contents_sp->GetByteSize() == 0) { - err.SetErrorStringWithFormat ("Couldn't read data from '%s'\n", value); + err.SetErrorStringWithFormat ("couldn't read data from '%s'", value); m_expr_prefix_contents_sp.reset(); } } diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index d30cfa1..eec77fb 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -79,7 +79,7 @@ TargetList::CreateTarget (Debugger &debugger, arch.SetTriple(triple_cstr, platform_sp.get()); if (!arch.IsValid()) { - error.SetErrorStringWithFormat("invalid triple '%s'\n", triple_cstr); + error.SetErrorStringWithFormat("invalid triple '%s'", triple_cstr); return error; } } |