Resolve printf formatting warnings on Linux:
- use macros from inttypes.h for format strings instead of OS-specific types

Patch from Matt Kopec!

llvm-svn: 168945
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 2edd52f..9d4d870 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -384,7 +384,7 @@
         if (section_sp)
         {
             section_sp->DumpName(s);
-            s->Printf (" + %llu", m_offset);
+            s->Printf (" + %" PRIu64, m_offset);
         }
         else
         {
@@ -465,7 +465,7 @@
                                         s->PutCString(symbol_name);
                                         addr_t delta = file_Addr - symbol->GetAddress().GetFileAddress();
                                         if (delta)
-                                            s->Printf(" + %llu", delta);
+                                            s->Printf(" + %" PRIu64, delta);
                                         showed_info = true;
                                     }
                                 }
@@ -703,7 +703,7 @@
                         if (var && var->LocationIsValidForAddress (*this))
                         {
                             s->Indent();
-                            s->Printf ("   Variable: id = {0x%8.8llx}, name = \"%s\", type= \"%s\", location =",
+                            s->Printf ("   Variable: id = {0x%8.8" PRIx64 "}, name = \"%s\", type= \"%s\", location =",
                                        var->GetID(),
                                        var->GetName().GetCString(),
                                        var->GetType()->GetName().GetCString());
diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp
index 2005022..835a01d 100644
--- a/lldb/source/Core/AddressRange.cpp
+++ b/lldb/source/Core/AddressRange.cpp
@@ -196,7 +196,7 @@
 void
 AddressRange::DumpDebug (Stream *s) const
 {
-    s->Printf("%p: AddressRange section = %p, offset = 0x%16.16llx, byte_size = 0x%16.16llx\n", this, m_base_addr.GetSection().get(), m_base_addr.GetOffset(), GetByteSize());
+    s->Printf("%p: AddressRange section = %p, offset = 0x%16.16" PRIx64 ", byte_size = 0x%16.16" PRIx64 "\n", this, m_base_addr.GetSection().get(), m_base_addr.GetOffset(), GetByteSize());
 }
 //
 //bool
diff --git a/lldb/source/Core/AddressResolverFileLine.cpp b/lldb/source/Core/AddressResolverFileLine.cpp
index 9300f90..78f156d 100644
--- a/lldb/source/Core/AddressResolverFileLine.cpp
+++ b/lldb/source/Core/AddressResolverFileLine.cpp
@@ -77,7 +77,7 @@
             else
             {
                 if (log)
-                  log->Printf ("error: Unable to resolve address at file address 0x%llx for %s:%d\n",
+                  log->Printf ("error: Unable to resolve address at file address 0x%" PRIx64 " for %s:%d\n",
                                line_start.GetFileAddress(),
                                m_file_spec.GetFilename().AsCString("<Unknown>"),
                                m_line_number);
diff --git a/lldb/source/Core/CXXFormatterFunctions.cpp b/lldb/source/Core/CXXFormatterFunctions.cpp
index 4607088..c458cf2 100644
--- a/lldb/source/Core/CXXFormatterFunctions.cpp
+++ b/lldb/source/Core/CXXFormatterFunctions.cpp
@@ -78,7 +78,7 @@
     StreamString expr_path_stream;
     valobj.GetExpressionPath(expr_path_stream, false);
     StreamString expr;
-    expr.Printf("(%s)[%s %s:%lld]",return_type,expr_path_stream.GetData(),selector,index);
+    expr.Printf("(%s)[%s %s:%" PRId64 "]",return_type,expr_path_stream.GetData(),selector,index);
     ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
     lldb::ValueObjectSP result_sp;
     Target* target = exe_ctx.GetTargetPtr();
@@ -200,7 +200,7 @@
             return false;
     }
     
-    stream.Printf("%s%llu %s%s",
+    stream.Printf("%s%" PRIu64 " %s%s",
                   (name_entries ? "@\"" : ""),
                   value,
                   (name_entries ? (value == 1 ? "entry" : "entries") : (value == 1 ? "key/value pair" : "key/value pairs")),
@@ -266,7 +266,7 @@
             return false;
     }
     
-    stream.Printf("@\"%llu object%s\"",
+    stream.Printf("@\"%" PRIu64 " object%s\"",
                   value,
                   value == 1 ? "" : "s");
     return true;
@@ -319,7 +319,7 @@
             return false;
     }
     
-    stream.Printf("%s%llu byte%s%s",
+    stream.Printf("%s%" PRIu64 " byte%s%s",
                   (needs_at ? "@\"" : ""),
                   value,
                   (value > 1 ? "s" : ""),
@@ -377,10 +377,10 @@
                     stream.Printf("(int)%d",(int)value);
                     break;
                 case 12:
-                    stream.Printf("(long)%lld",value);
+                    stream.Printf("(long)%" PRId64,value);
                     break;
                 default:
-                    stream.Printf("absurd value:(info=%llu, value=%llu",i_bits,value);
+                    stream.Printf("absurd value:(info=%" PRIu64 ", value=%" PRIu64,i_bits,value);
                     break;
             }
             return true;
@@ -419,7 +419,7 @@
                     value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 8, 0, error);
                     if (error.Fail())
                         return false;
-                    stream.Printf("(long)%lld",value);
+                    stream.Printf("(long)%" PRId64,value);
                     break;
                 case 5: // 0B0101
                 {
@@ -971,7 +971,7 @@
     if (error.Fail())
         return lldb::ValueObjectSP();
     StreamString expr;
-    expr.Printf("(id)%llu",object_at_idx);
+    expr.Printf("(id)%" PRIu64,object_at_idx);
     StreamString idx_name;
     idx_name.Printf("[%d]",idx);
     lldb::ValueObjectSP retval_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref);
@@ -1304,7 +1304,7 @@
     {
         // make the new ValueObject
         StreamString expr;
-        expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%llu ; _lldb_valgen_item.value = (id)%llu; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr);
+        expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%" PRIu64 " ; _lldb_valgen_item.value = (id)%" PRIu64 "; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr);
         StreamString idx_name;
         idx_name.Printf("[%d]",idx);
         dict_item.valobj_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref);
@@ -1456,7 +1456,7 @@
     {
         // make the new ValueObject
         StreamString expr;
-        expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%llu ; _lldb_valgen_item.value = (id)%llu; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr);
+        expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%" PRIu64 " ; _lldb_valgen_item.value = (id)%" PRIu64 "; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr);
         StreamString idx_name;
         idx_name.Printf("[%d]",idx);
         dict_item.valobj_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref);
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp
index 0c7a890..8d4385b 100644
--- a/lldb/source/Core/Communication.cpp
+++ b/lldb/source/Core/Communication.cpp
@@ -136,7 +136,7 @@
 Communication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status, Error *error_ptr)
 {
     lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
-                                         "%p Communication::Read (dst = %p, dst_len = %llu, timeout = %u usec) connection = %p",
+                                         "%p Communication::Read (dst = %p, dst_len = %" PRIu64 ", timeout = %u usec) connection = %p",
                                          this, 
                                          dst, 
                                          (uint64_t)dst_len,
@@ -210,7 +210,7 @@
 
     Mutex::Locker locker(m_write_mutex);
     lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
-                                         "%p Communication::Write (src = %p, src_len = %llu) connection = %p",
+                                         "%p Communication::Write (src = %p, src_len = %" PRIu64 ") connection = %p",
                                          this, 
                                          src, 
                                          (uint64_t)src_len,
@@ -295,7 +295,7 @@
 Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast, ConnectionStatus status)
 {
     lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
-                                 "%p Communication::AppendBytesToCache (src = %p, src_len = %llu, broadcast = %i)",
+                                 "%p Communication::AppendBytesToCache (src = %p, src_len = %" PRIu64 ", broadcast = %i)",
                                  this, bytes, (uint64_t)len, broadcast);
     if ((bytes == NULL || len == 0)
         && (status != lldb::eConnectionStatusEndOfFile))
diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp
index 238daab..91c2ff3 100644
--- a/lldb/source/Core/ConnectionFileDescriptor.cpp
+++ b/lldb/source/Core/ConnectionFileDescriptor.cpp
@@ -362,7 +362,7 @@
 {
     LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
     if (log)
-        log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %llu)...",
+        log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %" PRIu64 ")...",
                      this, m_fd_recv, dst, (uint64_t)dst_len);
 
     Mutex::Locker locker;
@@ -411,7 +411,7 @@
     }
 
     if (log)
-        log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %llu) => %lli, error = %s",
+        log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %" PRIu64 ") => %" PRIi64 ", error = %s",
                      this, 
                      m_fd_recv, 
                      dst, 
@@ -475,7 +475,7 @@
 {
     LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
     if (log)
-        log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %llu)", this, src, (uint64_t)src_len);
+        log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")", this, src, (uint64_t)src_len);
 
     if (!IsConnected ())
     {
@@ -530,7 +530,7 @@
         switch (m_fd_send_type)
         {
             case eFDTypeFile:       // Other FD requireing read/write
-                log->Printf ("%p ConnectionFileDescriptor::Write()  ::write (fd = %i, src = %p, src_len = %llu) => %lli (error = %s)",
+                log->Printf ("%p ConnectionFileDescriptor::Write()  ::write (fd = %i, src = %p, src_len = %" PRIu64 ") => %" PRIi64 " (error = %s)",
                              this, 
                              m_fd_send, 
                              src, 
@@ -540,7 +540,7 @@
                 break;
                 
             case eFDTypeSocket:     // Socket requiring send/recv
-                log->Printf ("%p ConnectionFileDescriptor::Write()  ::send (socket = %i, src = %p, src_len = %llu, flags = 0) => %lli (error = %s)",
+                log->Printf ("%p ConnectionFileDescriptor::Write()  ::send (socket = %i, src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)",
                              this, 
                              m_fd_send, 
                              src, 
@@ -550,7 +550,7 @@
                 break;
                 
             case eFDTypeSocketUDP:  // Unconnected UDP socket requiring sendto/recvfrom
-                log->Printf ("%p ConnectionFileDescriptor::Write()  ::sendto (socket = %i, src = %p, src_len = %llu, flags = 0) => %lli (error = %s)",
+                log->Printf ("%p ConnectionFileDescriptor::Write()  ::sendto (socket = %i, src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64 " (error = %s)",
                              this, 
                              m_fd_send, 
                              src, 
diff --git a/lldb/source/Core/ConstString.cpp b/lldb/source/Core/ConstString.cpp
index 7dfc553..72a4332 100644
--- a/lldb/source/Core/ConstString.cpp
+++ b/lldb/source/Core/ConstString.cpp
@@ -294,7 +294,7 @@
     size_t cstr_len = GetLength();
     // Only print the parens if we have a non-NULL string
     const char *parens = cstr ? "\"" : "";
-    s->Printf("%*p: ConstString, string = %s%s%s, length = %llu", (int)sizeof(void*) * 2, this, parens, cstr, parens, (uint64_t)cstr_len);
+    s->Printf("%*p: ConstString, string = %s%s%s, length = %" PRIu64, (int)sizeof(void*) * 2, this, parens, cstr, parens, (uint64_t)cstr_len);
 }
 
 void
diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp
index 8f9b56d..5e1403a 100644
--- a/lldb/source/Core/DataBufferMemoryMap.cpp
+++ b/lldb/source/Core/DataBufferMemoryMap.cpp
@@ -209,7 +209,7 @@
                         }
                         if (error.GetError() == ENOMEM)
                         {
-                           error.SetErrorStringWithFormat("could not allocate %lld bytes of memory to mmap in file", (uint64_t) length);
+                           error.SetErrorStringWithFormat("could not allocate %" PRId64 " bytes of memory to mmap in file", (uint64_t) length);
                         }
                     }
                     else
diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp
index d9255a4..9e948f4 100644
--- a/lldb/source/Core/DataExtractor.cpp
+++ b/lldb/source/Core/DataExtractor.cpp
@@ -1408,7 +1408,7 @@
                 s->EOL();
             }
             if (base_addr != LLDB_INVALID_ADDRESS)
-                s->Printf ("0x%8.8llx: ", (uint64_t)(base_addr + (offset - start_offset)));
+                s->Printf ("0x%8.8" PRIx64 ": ", (uint64_t)(base_addr + (offset - start_offset)));
             line_start_offset = offset;
         }
         else
@@ -1498,7 +1498,7 @@
                         if (item_byte_size == 1)
                             s->Printf ("\\x%2.2x", (uint8_t)ch); 
                         else
-                            s->Printf ("%llu", ch); 
+                            s->Printf ("%" PRIu64, ch);
                         break;
                     }
                 }
@@ -1516,7 +1516,7 @@
         case eFormatEnum:       // Print enum value as a signed integer when we don't get the enum type
         case eFormatDecimal:
             if (item_byte_size <= 8)
-                s->Printf ("%lld", GetMaxS64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
+                s->Printf ("%" PRId64, GetMaxS64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
             else
             {
                 const bool is_signed = true;
@@ -1527,7 +1527,7 @@
 
         case eFormatUnsigned:
             if (item_byte_size <= 8)
-                s->Printf ("%llu", GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
+                s->Printf ("%" PRIu64, GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
             else
             {
                 const bool is_signed = false;
@@ -1538,7 +1538,7 @@
 
         case eFormatOctal:
             if (item_byte_size <= 8)
-                s->Printf ("0%llo", GetMaxS64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
+                s->Printf ("0%" PRIo64, GetMaxS64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
             else
             {
                 const bool is_signed = false;
@@ -1632,8 +1632,8 @@
                 
                 if (complex_int_byte_size <= 8)
                 {
-                    s->Printf("%llu", GetMaxU64Bitfield(&offset, complex_int_byte_size, 0, 0));
-                    s->Printf(" + %llui", GetMaxU64Bitfield(&offset, complex_int_byte_size, 0, 0));
+                    s->Printf("%" PRIu64, GetMaxU64Bitfield(&offset, complex_int_byte_size, 0, 0));
+                    s->Printf(" + %" PRIu64 "i", GetMaxU64Bitfield(&offset, complex_int_byte_size, 0, 0));
                 }
                 else
                 {
@@ -1682,7 +1682,7 @@
                 bool wantsuppercase  = (item_format == eFormatHexUppercase);
                 if (item_byte_size <= 8)
                 {
-                    s->Printf(wantsuppercase ? "0x%*.*llX" : "0x%*.*llx", 2 * item_byte_size, 2 * item_byte_size, GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
+                    s->Printf(wantsuppercase ? "0x%*.*" PRIX64 : "0x%*.*" PRIx64, 2 * item_byte_size, 2 * item_byte_size, GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset));
                 }
                 else
                 {
@@ -1746,7 +1746,7 @@
         case eFormatAddressInfo:
             {
                 addr_t addr = GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset);
-                s->Printf("0x%*.*llx", 2 * item_byte_size, 2 * item_byte_size, addr);
+                s->Printf("0x%*.*" PRIx64, 2 * item_byte_size, 2 * item_byte_size, addr);
                 if (exe_scope)
                 {
                     TargetSP target_sp (exe_scope->CalculateTarget());
@@ -1923,7 +1923,7 @@
             }
             // Reset string offset and fill the current line string with address:
             if (base_addr != LLDB_INVALID_ADDRESS)
-                sstr.Printf("0x%8.8llx:", (uint64_t)(base_addr + (offset - start_offset)));
+                sstr.Printf("0x%8.8" PRIx64 ":", (uint64_t)(base_addr + (offset - start_offset)));
         }
 
         switch (type)
@@ -1938,10 +1938,10 @@
                 break;
             case TypeUInt16:  sstr.Printf (format ? format : " %4.4x",       GetU16(&offset)); break;
             case TypeUInt32:  sstr.Printf (format ? format : " %8.8x",       GetU32(&offset)); break;
-            case TypeUInt64:  sstr.Printf (format ? format : " %16.16llx",   GetU64(&offset)); break;
-            case TypePointer: sstr.Printf (format ? format : " 0x%llx",      GetAddress(&offset)); break;
-            case TypeULEB128: sstr.Printf (format ? format : " 0x%llx",      GetULEB128(&offset)); break;
-            case TypeSLEB128: sstr.Printf (format ? format : " %lld",        GetSLEB128(&offset)); break;
+            case TypeUInt64:  sstr.Printf (format ? format : " %16.16" PRIx64,   GetU64(&offset)); break;
+            case TypePointer: sstr.Printf (format ? format : " 0x%" PRIx64,      GetAddress(&offset)); break;
+            case TypeULEB128: sstr.Printf (format ? format : " 0x%" PRIx64,      GetULEB128(&offset)); break;
+            case TypeSLEB128: sstr.Printf (format ? format : " %" PRId64,        GetSLEB128(&offset)); break;
         }
     }
 
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 38baac4..aadbf4d 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1187,7 +1187,7 @@
             *index_lower = ::strtoul (*open_bracket_position+1, &end, 0);
             *index_higher = *index_lower;
             if (log)
-                log->Printf("[ScanBracketedRange] [%lld] detected, high index is same", *index_lower);
+                log->Printf("[ScanBracketedRange] [%" PRId64 "] detected, high index is same", *index_lower);
         }
         else if (*close_bracket_position && *close_bracket_position < var_name_end)
         {
@@ -1195,7 +1195,7 @@
             *index_lower = ::strtoul (*open_bracket_position+1, &end, 0);
             *index_higher = ::strtoul (*separator_position+1, &end, 0);
             if (log)
-                log->Printf("[ScanBracketedRange] [%lld-%lld] detected", *index_lower, *index_higher);
+                log->Printf("[ScanBracketedRange] [%" PRId64 "-%" PRId64 "] detected", *index_lower, *index_higher);
         }
         else
         {
@@ -1642,7 +1642,7 @@
                                         if (!item)
                                         {
                                             if (log)
-                                                log->Printf("[Debugger::FormatPrompt] ERROR in getting child item at index %lld", index_lower);
+                                                log->Printf("[Debugger::FormatPrompt] ERROR in getting child item at index %" PRId64, index_lower);
                                         }
                                         else
                                         {
@@ -1898,7 +1898,7 @@
                                         var_name_begin += ::strlen ("process.");
                                         if (::strncmp (var_name_begin, "id}", strlen("id}")) == 0)
                                         {
-                                            s.Printf("%llu", process->GetID());
+                                            s.Printf("%" PRIu64, process->GetID());
                                             var_success = true;
                                         }
                                         else if ((::strncmp (var_name_begin, "name}", strlen("name}")) == 0) ||
@@ -1936,7 +1936,7 @@
                                         var_name_begin += ::strlen ("thread.");
                                         if (::strncmp (var_name_begin, "id}", strlen("id}")) == 0)
                                         {
-                                            s.Printf("0x%4.4llx", thread->GetID());
+                                            s.Printf("0x%4.4" PRIx64, thread->GetID());
                                             var_success = true;
                                         }
                                         else if (::strncmp (var_name_begin, "index}", strlen("index}")) == 0)
@@ -2144,7 +2144,7 @@
                                     if (::strncmp (var_name_begin, "id}", strlen("id}")) == 0)
                                     {
                                         if (sc->function)
-                                            s.Printf("function{0x%8.8llx}", sc->function->GetID());
+                                            s.Printf("function{0x%8.8" PRIx64 "}", sc->function->GetID());
                                         else
                                             s.Printf("symbol[%u]", sc->symbol->GetID());
 
@@ -2430,9 +2430,9 @@
                                             addr_t func_file_addr = func_addr.GetFileAddress();
                                             addr_t addr_file_addr = format_addr.GetFileAddress();
                                             if (addr_file_addr > func_file_addr)
-                                                s.Printf(" + %llu", addr_file_addr - func_file_addr);
+                                                s.Printf(" + %" PRIu64, addr_file_addr - func_file_addr);
                                             else if (addr_file_addr < func_file_addr)
-                                                s.Printf(" - %llu", func_file_addr - addr_file_addr);
+                                                s.Printf(" - %" PRIu64, func_file_addr - addr_file_addr);
                                             var_success = true;
                                         }
                                         else
@@ -2443,9 +2443,9 @@
                                                 addr_t func_load_addr = func_addr.GetLoadAddress (target);
                                                 addr_t addr_load_addr = format_addr.GetLoadAddress (target);
                                                 if (addr_load_addr > func_load_addr)
-                                                    s.Printf(" + %llu", addr_load_addr - func_load_addr);
+                                                    s.Printf(" + %" PRIu64, addr_load_addr - func_load_addr);
                                                 else if (addr_load_addr < func_load_addr)
-                                                    s.Printf(" - %llu", func_load_addr - addr_load_addr);
+                                                    s.Printf(" - %" PRIu64, func_load_addr - addr_load_addr);
                                                 var_success = true;
                                             }
                                         }
@@ -2465,7 +2465,7 @@
                                         int addr_width = target->GetArchitecture().GetAddressByteSize() * 2;
                                         if (addr_width == 0)
                                             addr_width = 16;
-                                        s.Printf("0x%*.*llx", addr_width, addr_width, vaddr);
+                                        s.Printf("0x%*.*" PRIx64, addr_width, addr_width, vaddr);
                                         var_success = true;
                                     }
                                 }
diff --git a/lldb/source/Core/EmulateInstruction.cpp b/lldb/source/Core/EmulateInstruction.cpp
index 0e94e67..c773eeb 100644
--- a/lldb/source/Core/EmulateInstruction.cpp
+++ b/lldb/source/Core/EmulateInstruction.cpp
@@ -361,7 +361,7 @@
                                        size_t length)
 {
     StreamFile strm (stdout, false);
-    strm.Printf ("    Read from Memory (address = 0x%llx, length = %llu, context = ", addr, (uint64_t)length);
+    strm.Printf ("    Read from Memory (address = 0x%" PRIx64 ", length = %" PRIu64 ", context = ", addr, (uint64_t)length);
     context.Dump (strm, instruction);    
     strm.EOL();
     *((uint64_t *) dst) = 0xdeadbeef;
@@ -377,7 +377,7 @@
                                         size_t length)
 {
     StreamFile strm (stdout, false);
-    strm.Printf ("    Write to Memory (address = 0x%llx, length = %llu, context = ", addr, (uint64_t)length);
+    strm.Printf ("    Write to Memory (address = 0x%" PRIx64 ", length = %" PRIu64 ", context = ", addr, (uint64_t)length);
     context.Dump (strm, instruction);    
     strm.EOL();
     return length;
@@ -503,7 +503,7 @@
     {
     case eInfoTypeRegisterPlusOffset:
         {
-            strm.Printf (" (reg_plus_offset = %s%+lld)",
+            strm.Printf (" (reg_plus_offset = %s%+" PRId64 ")",
                          info.RegisterPlusOffset.reg.name,
                          info.RegisterPlusOffset.signed_offset);
         }
@@ -519,7 +519,7 @@
 
     case eInfoTypeRegisterToRegisterPlusOffset:
         {
-            strm.Printf (" (base_and_imm_offset = %s%+lld, data_reg = %s)", 
+            strm.Printf (" (base_and_imm_offset = %s%+" PRId64 ", data_reg = %s)",
                          info.RegisterToRegisterPlusOffset.base_reg.name, 
                          info.RegisterToRegisterPlusOffset.offset,
                          info.RegisterToRegisterPlusOffset.data_reg.name);
@@ -544,7 +544,7 @@
         break;
 
     case eInfoTypeOffset:
-        strm.Printf (" (signed_offset = %+lld)", info.signed_offset);
+        strm.Printf (" (signed_offset = %+" PRId64 ")", info.signed_offset);
         break;
         
     case eInfoTypeRegister:
@@ -552,19 +552,19 @@
         break;
         
     case eInfoTypeImmediate:
-        strm.Printf (" (unsigned_immediate = %llu (0x%16.16llx))", 
+        strm.Printf (" (unsigned_immediate = %" PRIu64 " (0x%16.16" PRIx64 "))",
                      info.unsigned_immediate, 
                      info.unsigned_immediate);
         break;
 
     case eInfoTypeImmediateSigned:
-        strm.Printf (" (signed_immediate = %+lld (0x%16.16llx))", 
+        strm.Printf (" (signed_immediate = %+" PRId64 " (0x%16.16" PRIx64 "))",
                      info.signed_immediate, 
                      info.signed_immediate);
         break;
         
     case eInfoTypeAddress:
-        strm.Printf (" (address = 0x%llx)", info.address);
+        strm.Printf (" (address = 0x%" PRIx64 ")", info.address);
         break;
         
     case eInfoTypeISAAndImmediate:
diff --git a/lldb/source/Core/History.cpp b/lldb/source/Core/History.cpp
index 929c854..0105dce 100644
--- a/lldb/source/Core/History.cpp
+++ b/lldb/source/Core/History.cpp
@@ -10,6 +10,7 @@
 #include "lldb/Core/History.h"
 
 // C Includes
+#include <inttypes.h>
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
@@ -21,5 +22,5 @@
 void
 HistorySourceUInt::DumpHistoryEvent (Stream &strm, HistoryEvent event)
 {
-    strm.Printf ("%s %llu", m_name.c_str(), (uint64_t)((uintptr_t)event));
+    strm.Printf ("%s %" PRIu64, m_name.c_str(), (uint64_t)((uintptr_t)event));
 }
diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp
index 17281c0..b8671f7 100644
--- a/lldb/source/Core/Log.cpp
+++ b/lldb/source/Core/Log.cpp
@@ -100,12 +100,12 @@
         if (m_options.Test (LLDB_LOG_OPTION_PREPEND_TIMESTAMP))
         {
             struct timeval tv = TimeValue::Now().GetAsTimeVal();
-            header.Printf ("%9ld.%6.6d ", tv.tv_sec, tv.tv_usec);
+            header.Printf ("%9ld.%6.6ld ", tv.tv_sec, tv.tv_usec);
         }
 
         // Add the process and thread if requested
         if (m_options.Test (LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD))
-            header.Printf ("[%4.4x/%4.4llx]: ", getpid(), Host::GetCurrentThreadID());
+            header.Printf ("[%4.4x/%4.4" PRIx64 "]: ", getpid(), Host::GetCurrentThreadID());
 
         // Add the process and thread if requested
         if (m_options.Test (LLDB_LOG_OPTION_PREPEND_THREAD_NAME))
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index e349d63..e03c499 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -103,7 +103,7 @@
         Mutex::Locker locker (Module::GetAllocationModuleCollectionMutex());
         ModuleCollection &modules = GetModuleCollection();
         const size_t count = modules.size();
-        printf ("%s: %llu modules:\n", __PRETTY_FUNCTION__, (uint64_t)count);
+        printf ("%s: %" PRIu64 " modules:\n", __PRETTY_FUNCTION__, (uint64_t)count);
         for (size_t i=0; i<count; ++i)
         {
             
@@ -263,7 +263,7 @@
                 if (m_objfile_sp)
                 {
                     StreamString s;
-                    s.Printf("0x%16.16llx", header_addr);
+                    s.Printf("0x%16.16" PRIx64, header_addr);
                     m_object_name.SetCString (s.GetData());
 
                     // Once we get the object file, update our module with the object file's
@@ -429,7 +429,7 @@
 Module::ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr)
 {
     Mutex::Locker locker (m_mutex);
-    Timer scoped_timer(__PRETTY_FUNCTION__, "Module::ResolveFileAddress (vm_addr = 0x%llx)", vm_addr);
+    Timer scoped_timer(__PRETTY_FUNCTION__, "Module::ResolveFileAddress (vm_addr = 0x%" PRIx64 ")", vm_addr);
     ObjectFile* ofile = GetObjectFile();
     if (ofile)
         return so_addr.ResolveAddressUsingFileSections(vm_addr, ofile->GetSectionList());
diff --git a/lldb/source/Core/Opcode.cpp b/lldb/source/Core/Opcode.cpp
index 3793bde..d987865 100644
--- a/lldb/source/Core/Opcode.cpp
+++ b/lldb/source/Core/Opcode.cpp
@@ -46,7 +46,7 @@
         break;
 
     case Opcode::eType64:
-        bytes_written = s->Printf ("0x%16.16llx", m_data.inst64); 
+        bytes_written = s->Printf ("0x%16.16" PRIx64, m_data.inst64);
         break;
 
     case Opcode::eTypeBytes:
diff --git a/lldb/source/Core/RegisterValue.cpp b/lldb/source/Core/RegisterValue.cpp
index 5f2e2e5..f546e01 100644
--- a/lldb/source/Core/RegisterValue.cpp
+++ b/lldb/source/Core/RegisterValue.cpp
@@ -462,7 +462,7 @@
                 if (!success)
                     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", uval64, byte_size);
+                    error.SetErrorStringWithFormat ("value 0x%" PRIx64 " is too large to fit in a %u byte unsigned integer value", uval64, byte_size);
                 else
                 {
                     if (!SetUInt (uval64, reg_info->byte_size))
@@ -483,7 +483,7 @@
                 if (!success)
                     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", sval64, byte_size);
+                    error.SetErrorStringWithFormat ("value 0x%" PRIx64 " is too large to fit in a %u byte signed integer value", sval64, byte_size);
                 else
                 {
                     if (!SetUInt (sval64, reg_info->byte_size))
diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp
index eaf0bc5..e791236 100644
--- a/lldb/source/Core/Scalar.cpp
+++ b/lldb/source/Core/Scalar.cpp
@@ -10,6 +10,7 @@
 #include "lldb/Core/Scalar.h"
 
 #include <math.h>
+#include <inttypes.h>
 
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Core/Error.h"
@@ -1833,7 +1834,7 @@
             if (!success)
                 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", uval64, byte_size);
+                error.SetErrorStringWithFormat ("value 0x%" PRIx64 " is too large to fit in a %u byte unsigned integer value", uval64, byte_size);
             else
             {
                 m_type = Scalar::GetValueTypeForUnsignedIntegerWithByteSize (byte_size);
@@ -1862,7 +1863,7 @@
             if (!success)
                 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", sval64, byte_size);
+                error.SetErrorStringWithFormat ("value 0x%" PRIx64 " is too large to fit in a %u byte signed integer value", sval64, byte_size);
             else
             {
                 m_type = Scalar::GetValueTypeForSignedIntegerWithByteSize (byte_size);
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 54bbe17..0efa39a 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -41,7 +41,7 @@
     m_linked_section_wp(),
     m_linked_offset (0)
 {
-//    printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16llx, addr=[0x%16.16llx - 0x%16.16llx), file [0x%16.16llx - 0x%16.16llx), flags = 0x%8.8x, name = %s\n",
+//    printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16" PRIx64 ", addr=[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), file [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), flags = 0x%8.8x, name = %s\n",
 //            this, module_sp.get(), sect_id, file_addr, file_addr + byte_size, file_offset, file_offset + file_size, flags, name.GetCString());
 }
 
@@ -72,7 +72,7 @@
     m_linked_section_wp(),
     m_linked_offset (0)
 {
-//    printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16llx, addr=[0x%16.16llx - 0x%16.16llx), file [0x%16.16llx - 0x%16.16llx), flags = 0x%8.8x, name = %s.%s\n",
+//    printf ("Section::Section(%p): module=%p, sect_id = 0x%16.16" PRIx64 ", addr=[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), file [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 "), flags = 0x%8.8x, name = %s.%s\n",
 //            this, module_sp.get(), sect_id, file_addr, file_addr + byte_size, file_offset, file_offset + file_size, flags, parent_section_sp->GetName().GetCString(), name.GetCString());
     if (parent_section_sp)
         m_parent_wp = parent_section_sp;
@@ -257,7 +257,7 @@
 {
 //    s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
     s->Indent();
-    s->Printf("0x%8.8llx %-16s ", GetID(), GetSectionTypeAsCString (m_type));
+    s->Printf("0x%8.8" PRIx64 " %-16s ", GetID(), GetSectionTypeAsCString (m_type));
     bool resolved = true;
     addr_t addr = LLDB_INVALID_ADDRESS;
 
@@ -280,7 +280,7 @@
         range.Dump (s, 0);
     }
 
-    s->Printf("%c 0x%8.8llx 0x%8.8llx 0x%8.8x ", resolved ? ' ' : '*', m_file_offset, m_file_size, Get());
+    s->Printf("%c 0x%8.8" PRIx64 " 0x%8.8" PRIx64 " 0x%8.8x ", resolved ? ' ' : '*', m_file_offset, m_file_size, Get());
 
     DumpName (s);
 
@@ -312,7 +312,7 @@
         s->Printf("%c%*.*s", resolved ? ' ' : '*', indent, indent, "");
 
         linked_section_sp->DumpName(s);
-        s->Printf(" + 0x%llx\n", m_linked_offset);
+        s->Printf(" + 0x%" PRIx64 "\n", m_linked_offset);
     }
 
     if (depth > 0)
diff --git a/lldb/source/Core/Stream.cpp b/lldb/source/Core/Stream.cpp
index 6e5f99c..bb1af7b 100644
--- a/lldb/source/Core/Stream.cpp
+++ b/lldb/source/Core/Stream.cpp
@@ -14,6 +14,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include <inttypes.h>
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -85,7 +87,7 @@
     }
     else
     {
-        bytes_written = Printf ("0x%lli", sval);
+        bytes_written = Printf ("0x%" PRIi64, sval);
     }
 
     return bytes_written;
@@ -117,7 +119,7 @@
     }
     else
     {
-        bytes_written = Printf ("0x%llx", uval);
+        bytes_written = Printf ("0x%" PRIx64, uval);
     }
     return bytes_written;
 }
@@ -157,8 +159,8 @@
     if (suffix == NULL)
         suffix = "";
 //    int addr_width = m_addr_size << 1;
-//    Printf ("%s0x%0*llx%s", prefix, addr_width, addr, suffix);
-    Printf ("%s0x%0*llx%s", prefix, addr_size * 2, (uint64_t)addr, suffix);
+//    Printf ("%s0x%0*" PRIx64 "%s", prefix, addr_width, addr, suffix);
+    Printf ("%s0x%0*" PRIx64 "%s", prefix, addr_size * 2, (uint64_t)addr, suffix);
 }
 
 //------------------------------------------------------------------
@@ -364,7 +366,7 @@
 Stream&
 Stream::operator<< (int64_t sval)
 {
-    Printf ("%lli", sval);
+    Printf ("%" PRIi64, sval);
     return *this;
 }
 
diff --git a/lldb/source/Core/UserID.cpp b/lldb/source/Core/UserID.cpp
index ad042df..57ffce9 100644
--- a/lldb/source/Core/UserID.cpp
+++ b/lldb/source/Core/UserID.cpp
@@ -10,6 +10,8 @@
 #include "lldb/Core/UserID.h"
 #include "lldb/Core/Stream.h"
 
+#include <inttypes.h>
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -20,6 +22,6 @@
 Stream&
 lldb_private::operator << (Stream& strm, const UserID& uid)
 {
-    strm.Printf("{0x%8.8llx}", uid.GetID());
+    strm.Printf("{0x%8.8" PRIx64 "}", uid.GetID());
     return strm;
 }
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index 4e31a7b..b6b4eb7 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -456,14 +456,14 @@
                         if (module)
                         {
                             if (variable)
-                                error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%llx for variable '%s' in %s%s%s", 
+                                error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64 " for variable '%s' in %s%s%s",
                                                                 address, 
                                                                 variable->GetName().AsCString(""),
                                                                 module->GetFileSpec().GetDirectory().GetCString(),
                                                                 module->GetFileSpec().GetDirectory() ? "/" : "",
                                                                 module->GetFileSpec().GetFilename().GetCString());
                             else
-                                error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%llx in %s%s%s", 
+                                error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64 " in %s%s%s",
                                                                 address, 
                                                                 module->GetFileSpec().GetDirectory().GetCString(),
                                                                 module->GetFileSpec().GetDirectory() ? "/" : "",
@@ -472,11 +472,11 @@
                         else
                         {
                             if (variable)
-                                error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%llx for variable '%s'", 
+                                error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64 " for variable '%s'",
                                                                 address, 
                                                                 variable->GetName().AsCString(""));
                             else
-                                error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%llx", address);
+                                error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64, address);
                         }
                     }
                 }
@@ -555,7 +555,7 @@
                 const bool prefer_file_cache = false;
                 if (exe_ctx->GetTargetRef().ReadMemory(file_so_addr, prefer_file_cache, dst, byte_size, error) != byte_size)
                 {
-                    error.SetErrorStringWithFormat("read memory from 0x%llx failed", (uint64_t)address);
+                    error.SetErrorStringWithFormat("read memory from 0x%" PRIx64 " failed", (uint64_t)address);
                 }
             }
             else
@@ -570,14 +570,14 @@
                 {
                     const size_t bytes_read = process->ReadMemory(address, dst, byte_size, error);
                     if (bytes_read != byte_size)
-                        error.SetErrorStringWithFormat("read memory from 0x%llx failed (%u of %u bytes read)", 
+                        error.SetErrorStringWithFormat("read memory from 0x%" PRIx64 " failed (%u of %u bytes read)",
                                                        (uint64_t)address, 
                                                        (uint32_t)bytes_read, 
                                                        (uint32_t)byte_size);
                 }
                 else
                 {
-                    error.SetErrorStringWithFormat("read memory from 0x%llx failed (invalid process)", (uint64_t)address);                    
+                    error.SetErrorStringWithFormat("read memory from 0x%" PRIx64 " failed (invalid process)", (uint64_t)address);
                 }
             }
         }