Change Error::SetErrorStringWithFormat() prototype to use an
__attribute__ format so the compiler knows that this method takes
printf style formatter arguments and checks that it's being used
correctly.  Fix a couple dozen incorrect SetErrorStringWithFormat()
calls throughout the sources.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140115 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index dd5f166..8347d00 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -3429,7 +3429,7 @@
                     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/source/Core/ModuleList.cpp b/source/Core/ModuleList.cpp
index 5cde91f..ebbbcd3 100644
--- a/source/Core/ModuleList.cpp
+++ b/source/Core/ModuleList.cpp
@@ -865,7 +865,7 @@
                 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 @@
                         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/source/Core/UserSettingsController.cpp b/source/Core/UserSettingsController.cpp
index 8669167..404526b 100644
--- a/source/Core/UserSettingsController.cpp
+++ b/source/Core/UserSettingsController.cpp
@@ -2134,9 +2134,9 @@
             
             
             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 @@
             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/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp
index e63cc34..1d3b749 100644
--- a/source/Core/ValueObject.cpp
+++ b/source/Core/ValueObject.cpp
@@ -1053,7 +1053,7 @@
                                 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/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index ea256f0..1af41b5 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -1854,7 +1854,7 @@
         Error write_error (reg_ctx.WriteRegisterValueToMemory(&reg_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/source/Expression/DWARFExpression.cpp b/source/Expression/DWARFExpression.cpp
index d47c045..b5cd852 100644
--- a/source/Expression/DWARFExpression.cpp
+++ b/source/Expression/DWARFExpression.cpp
@@ -2395,7 +2395,7 @@
                 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/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index aef5131..d33d16d 100644
--- a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -96,7 +96,7 @@
             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/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp
index ff05bc8..417be75 100644
--- a/source/Target/StackFrame.cpp
+++ b/source/Target/StackFrame.cpp
@@ -745,7 +745,7 @@
                                         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("<invalid type>"),
                                                                             var_expr_path_strm.GetString().c_str());
@@ -756,7 +756,7 @@
                                             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("<invalid type>"),
                                                                                 var_expr_path_strm.GetString().c_str());
@@ -769,7 +769,7 @@
                                         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("<invalid type>"),
                                                                             var_expr_path_strm.GetString().c_str());
@@ -784,7 +784,7 @@
                                     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("<invalid type>"),
                                                                         var_expr_path_strm.GetString().c_str());
@@ -797,7 +797,7 @@
                                     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("<invalid type>"),
                                                                         var_expr_path_strm.GetString().c_str());
@@ -818,7 +818,7 @@
                                     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("<invalid type>"),
                                                                         var_expr_path_strm.GetString().c_str());
@@ -829,7 +829,7 @@
                                         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("<invalid type>"),
                                                                             var_expr_path_strm.GetString().c_str());
@@ -930,7 +930,7 @@
                                         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("<invalid type>"),
                                                                             var_expr_path_strm.GetString().c_str());
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index d6c2dc2..fd9eb24 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -769,7 +769,8 @@
             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());
         }