diff --git a/lldb/include/lldb/Core/Error.h b/lldb/include/lldb/Core/Error.h index a0476c8353b9..378c6788e33a 100644 --- a/lldb/include/lldb/Core/Error.h +++ b/lldb/include/lldb/Core/Error.h @@ -266,7 +266,7 @@ public: /// A printf style format string //------------------------------------------------------------------ int - SetErrorStringWithFormat (const char *format, ...); + SetErrorStringWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3))); int SetErrorStringWithVarArg (const char *format, va_list args); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index dd5f166b7c63..8347d00aa6c5 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -3429,7 +3429,7 @@ public: m_one_liner = option_arg; break; default: - error.SetErrorStringWithFormat ("Unrecognized option %c."); + error.SetErrorStringWithFormat ("Unrecognized option %c.", short_option); break; } return error; diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 5cde91fa7d28..ebbbcd31820f 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -865,7 +865,7 @@ 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[0]); + error.SetErrorStringWithFormat("'%s' does not contain the %s architecture and UUID %s.\n", path, arch.GetArchitectureName(), uuid_cstr); else error.SetErrorStringWithFormat("'%s' does not contain the %s architecture.\n", path, arch.GetArchitectureName()); } @@ -941,9 +941,9 @@ ModuleList::GetSharedModule uuid_cstr[0] = '\0'; if (uuid_cstr[0]) - error.SetErrorStringWithFormat("Cannot locate a module for UUID '%s'.\n", uuid_cstr[0]); + error.SetErrorStringWithFormat("Cannot locate a module for UUID '%s'.\n", uuid_cstr); else - error.SetErrorStringWithFormat("Cannot locate a module.\n", path, arch.GetArchitectureName()); + error.SetErrorStringWithFormat("Cannot locate a module.\n"); } } } diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index 8669167ff919..404526b663e3 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -2134,9 +2134,9 @@ UserSettingsController::UpdateBooleanVariable (VarSetOperationType op, if (value_cstr == NULL) - err.SetErrorStringWithFormat ("invalid boolean string value (NULL)\n", value_cstr); + err.SetErrorStringWithFormat ("invalid boolean string value (NULL)\n"); else if (value_cstr[0] == '\0') - err.SetErrorStringWithFormat ("invalid boolean string value (empty)\n", value_cstr); + err.SetErrorStringWithFormat ("invalid boolean string value (empty)\n"); else { bool new_value = Args::StringToBoolean (value_cstr, false, &success); @@ -2180,9 +2180,9 @@ UserSettingsController::UpdateBooleanOptionValue (const char *value, error = option_value.SetValueFromCString(value); if (value == NULL) - error.SetErrorStringWithFormat ("invalid boolean string value (NULL)\n", value); + error.SetErrorStringWithFormat ("invalid boolean string value (NULL)\n"); else if (value[0] == '\0') - error.SetErrorStringWithFormat ("invalid boolean string value (empty)\n", value); + error.SetErrorStringWithFormat ("invalid boolean string value (empty)\n"); else { bool new_value = Args::StringToBoolean (value, false, &success); diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index e63cc34782df..1d3b749e347a 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -1053,7 +1053,7 @@ ValueObject::GetValueAsCString () m_value_str.swap(sstr.GetString()); else { - m_error.SetErrorStringWithFormat ("unsufficient data for value (only %u of %u bytes available)", + m_error.SetErrorStringWithFormat ("unsufficient data for value (only %lu of %lu bytes available)", m_data.GetByteSize(), GetByteSize()); m_value_str.clear(); diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index ea256f09948d..1af41b536a4c 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -1854,7 +1854,7 @@ ClangExpressionDeclMap::DoMaterializeOneRegister Error write_error (reg_ctx.WriteRegisterValueToMemory(®_info, addr, register_byte_size, reg_value)); if (write_error.Fail()) { - err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s", write_error.AsCString()); + err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s", reg_info.name, write_error.AsCString()); return false; } } diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index d47c045a5552..b5cd852e497e 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -2395,7 +2395,7 @@ DWARFExpression::Evaluate if (member_bit_incr % 8) { if (error_ptr) - error_ptr->SetErrorStringWithFormat("Array increment is not byte aligned", index, size); + error_ptr->SetErrorStringWithFormat("Array increment is not byte aligned"); return false; } int64_t member_offset = (int64_t)(member_bit_incr / 8) * index; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index aef5131d7ec7..d33d16d25208 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -96,7 +96,7 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file, if (resolved_exe_file.Exists()) error.Clear(); else - error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root."); + error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", resolved_exe_file.GetFilename().AsCString("")); } } diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index ff05bc80dba3..417be751b9d3 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -745,7 +745,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, else if (child_index >= synthetic->GetNumChildren() /* synthetic does not have that many values */) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); - error.SetErrorStringWithFormat ("array index %i is not valid for \"(%s) %s\"", + error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", child_index, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); @@ -756,7 +756,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, if (!child_valobj_sp) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); - error.SetErrorStringWithFormat ("array index %i is not valid for \"(%s) %s\"", + error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", child_index, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); @@ -769,7 +769,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, if (!child_valobj_sp) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); - error.SetErrorStringWithFormat ("failed to use pointer as array for index %i for \"(%s) %s\"", + error.SetErrorStringWithFormat ("failed to use pointer as array for index %ld for \"(%s) %s\"", child_index, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); @@ -784,7 +784,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, if (!child_valobj_sp) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); - error.SetErrorStringWithFormat ("array index %i is not valid for \"(%s) %s\"", + error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", child_index, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); @@ -797,7 +797,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, if (!child_valobj_sp) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); - error.SetErrorStringWithFormat ("bitfield range %i-%i is not valid for \"(%s) %s\"", + error.SetErrorStringWithFormat ("bitfield range %ld-%ld is not valid for \"(%s) %s\"", child_index, child_index, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); @@ -818,7 +818,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, else if (child_index >= synthetic->GetNumChildren() /* synthetic does not have that many values */) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); - error.SetErrorStringWithFormat ("array index %i is not valid for \"(%s) %s\"", + error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", child_index, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); @@ -829,7 +829,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, if (!child_valobj_sp) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); - error.SetErrorStringWithFormat ("array index %i is not valid for \"(%s) %s\"", + error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", child_index, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); @@ -930,7 +930,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, if (!child_valobj_sp) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); - error.SetErrorStringWithFormat ("bitfield range %i-%i is not valid for \"(%s) %s\"", + error.SetErrorStringWithFormat ("bitfield range %ld-%ld is not valid for \"(%s) %s\"", child_index, final_index, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index d6c2dc2e0865..fd9eb2438fa2 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -769,7 +769,8 @@ Target::ReadMemory (const Address& addr, if (resolved_addr.GetModule() && resolved_addr.GetModule()->GetFileSpec()) error.SetErrorStringWithFormat("%s[0x%llx] can't be resolved, %s in not currently loaded.\n", resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString(), - resolved_addr.GetFileAddress()); + resolved_addr.GetFileAddress(), + resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString()); else error.SetErrorStringWithFormat("0x%llx can't be resolved.\n", resolved_addr.GetFileAddress()); }