lldb should warn when dSYM does not match the binary.

o Symbols.cpp:

  Emit a warning message when dSYM does not match the binary.

o warnings/uuid:

  Added regression test case.

o lldbtest.py:

  Modified to allow test case writer to demand that the build command does not begin
  with a clean first; required to make TestUUIDMismatchWanring.py work.

rdar://problem/10515708


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149465 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/macosx/Symbols.cpp b/source/Host/macosx/Symbols.cpp
index acaf563..8201266 100644
--- a/source/Host/macosx/Symbols.cpp
+++ b/source/Host/macosx/Symbols.cpp
@@ -24,6 +24,7 @@
 #include "lldb/Core/Timer.h"
 #include "lldb/Core/UUID.h"
 #include "lldb/Host/Endian.h"
+#include "lldb/Host/Host.h"
 #include "lldb/Utility/CleanUp.h"
 #include "Host/macosx/cfcpp/CFCBundle.h"
 #include "Host/macosx/cfcpp/CFCReleaser.h"
@@ -116,7 +117,18 @@
         if (cmd == LoadCommandUUID)
         {
             lldb_private::UUID file_uuid (data.GetData(&data_offset, 16), 16);
-            return file_uuid == *uuid;
+            if (file_uuid == *uuid)
+                return true;
+
+            // Emit some warning messages since the UUIDs do not match!
+            char path_buf[PATH_MAX];
+            path_buf[0] = '\0';
+            const char *path = file_spec.GetPath(path_buf, PATH_MAX) ? path_buf
+                                                                     : file_spec.GetFilename().AsCString();
+            Host::SystemLog (Host::eSystemLogWarning, 
+                             "warning: UUID mismatch detected between binary and:\n\t'%s'\n", 
+                             path);
+            return false;
         }
         data_offset = cmd_offset + cmd_size;
     }