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

Patch from Matt Kopec!



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168945 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBAddress.cpp b/source/API/SBAddress.cpp
index 39b613b..8c4f5f1 100644
--- a/source/API/SBAddress.cpp
+++ b/source/API/SBAddress.cpp
@@ -133,7 +133,7 @@
         if (addr == LLDB_INVALID_ADDRESS)
             log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS", target_sp.get());
         else
-            log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%llx", target_sp.get(), addr);
+            log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%" PRIx64, target_sp.get(), addr);
     }
 
     return addr;
diff --git a/source/API/SBBlock.cpp b/source/API/SBBlock.cpp
index 91324ed..c8a665f 100644
--- a/source/API/SBBlock.cpp
+++ b/source/API/SBBlock.cpp
@@ -183,7 +183,7 @@
     if (m_opaque_ptr)
     {
         lldb::user_id_t id = m_opaque_ptr->GetID();
-        strm.Printf ("Block: {id: %llu} ", id);
+        strm.Printf ("Block: {id: %" PRIu64 "} ", id);
         if (IsInlined())
         {
             strm.Printf (" (inlined, '%s') ", GetInlinedName());
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index b0b1e2a..f0e2917 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -353,7 +353,7 @@
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4llx)", m_opaque_sp.get(), tid);
+        log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4" PRIx64 ")", m_opaque_sp.get(), tid);
 
 }
 
@@ -369,7 +369,7 @@
 
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4llx", m_opaque_sp.get(), tid);
+        log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4" PRIx64, m_opaque_sp.get(), tid);
     return tid;
 }
 
@@ -479,7 +479,7 @@
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %llu", m_opaque_sp.get(), (uint64_t)num_resolved);
+        log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_resolved);
     return num_resolved;
 }
 
@@ -494,7 +494,7 @@
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %llu", m_opaque_sp.get(), (uint64_t)num_locs);
+        log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_locs);
     return num_locs;
 }
 
@@ -508,7 +508,7 @@
         m_opaque_sp->GetResolverDescription (s.get());
         m_opaque_sp->GetFilterDescription (s.get());
         const size_t num_locations = m_opaque_sp->GetNumLocations ();
-        s.Printf(", locations = %llu", (uint64_t)num_locations);
+        s.Printf(", locations = %" PRIu64, (uint64_t)num_locations);
         return true;
     }
     s.Printf ("No value");
diff --git a/source/API/SBCommandInterpreter.cpp b/source/API/SBCommandInterpreter.cpp
index 3f22a17..15ffe65 100644
--- a/source/API/SBCommandInterpreter.cpp
+++ b/source/API/SBCommandInterpreter.cpp
@@ -166,7 +166,7 @@
         return 0;
         
     if (log)
-        log->Printf ("SBCommandInterpreter(%p)::HandleCompletion (current_line=\"%s\", cursor at: %lld, last char at: %lld, match_start_point: %d, max_return_elements: %d)",
+        log->Printf ("SBCommandInterpreter(%p)::HandleCompletion (current_line=\"%s\", cursor at: %" PRId64 ", last char at: %" PRId64 ", match_start_point: %d, max_return_elements: %d)",
                      m_opaque_ptr, current_line, (uint64_t) (cursor - current_line), (uint64_t) (last_char - current_line), match_start_point, max_return_elements);
                      
     if (m_opaque_ptr)
diff --git a/source/API/SBCommunication.cpp b/source/API/SBCommunication.cpp
index 80f557c..f96a064 100644
--- a/source/API/SBCommunication.cpp
+++ b/source/API/SBCommunication.cpp
@@ -139,7 +139,7 @@
 {
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%llu, timeout_usec=%u, &status)...", 
+        log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%" PRIu64 ", timeout_usec=%u, &status)...",
                      m_opaque,
                      dst,
                      (uint64_t)dst_len,
@@ -151,7 +151,7 @@
         status = eConnectionStatusNoConnection;
 
     if (log)
-        log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%llu, timeout_usec=%u, &status=%s) => %llu", 
+        log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%" PRIu64 ", timeout_usec=%u, &status=%s) => %" PRIu64,
                      m_opaque,
                      dst,
                      (uint64_t)dst_len,
@@ -173,7 +173,7 @@
 
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%llu, &status=%s) => %llu", 
+        log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%" PRIu64 ", &status=%s) => %" PRIu64,
                      m_opaque, src, (uint64_t)src_len, Communication::ConnectionStatusAsCString (status), (uint64_t)bytes_written);
 
     return 0;
diff --git a/source/API/SBData.cpp b/source/API/SBData.cpp
index 60b451c..9f9bc4f 100644
--- a/source/API/SBData.cpp
+++ b/source/API/SBData.cpp
@@ -322,7 +322,7 @@
     }
     if (log)
         log->Printf ("SBData::GetUnsignedInt64 (error=%p,offset=%d) => "
-                     "(%lld)", error.get(), offset, value);
+                     "(%" PRId64 ")", error.get(), offset, value);
     return value;
 }
 
@@ -410,7 +410,7 @@
     }
     if (log)
         log->Printf ("SBData::GetSignedInt64 (error=%p,offset=%d) => "
-                     "(%lld)", error.get(), offset, value);
+                     "(%" PRId64 ")", error.get(), offset, value);
     return value;
 }
 
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 94af679..af9447a 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -800,7 +800,7 @@
     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
-        log->Printf ("SBDebugger(%p)::DispatchInput (data=\"%.*s\", size_t=%llu)",
+        log->Printf ("SBDebugger(%p)::DispatchInput (data=\"%.*s\", size_t=%" PRIu64 ")",
                      m_opaque_sp.get(),
                      (int) data_len,
                      (const char *) data,
@@ -1049,7 +1049,7 @@
     {
         const char *name = m_opaque_sp->GetInstanceName().AsCString();
         user_id_t id = m_opaque_sp->GetID();
-        strm.Printf ("Debugger (instance: \"%s\", id: %llu)", name, id);
+        strm.Printf ("Debugger (instance: \"%s\", id: %" PRIu64 ")", name, id);
     }
     else
         strm.PutCString ("No value");
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index d494846..cabf090 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -154,7 +154,7 @@
         result = m_opaque_ap->GetPath (dst_path, dst_len);
 
     if (log)
-        log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%llu) => %u", 
+        log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%" PRIu64 ") => %u",
                      m_opaque_ap.get(), result, dst_path, (uint64_t)dst_len, result);
 
     if (result == 0 && dst_path && dst_len > 0)
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 87c1f22..8b7cacc 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -478,7 +478,7 @@
     }
 
     if (log)
-        log->Printf ("SBFrame(%p)::GetPC () => 0x%llx", frame, addr);
+        log->Printf ("SBFrame(%p)::GetPC () => 0x%" PRIx64, frame, addr);
 
     return addr;
 }
@@ -518,7 +518,7 @@
     }
 
     if (log)
-        log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%llx) => %i", 
+        log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%" PRIx64 ") => %i",
                      frame, new_pc, ret_val);
 
     return ret_val;
@@ -558,7 +558,7 @@
         }
     }
     if (log)
-        log->Printf ("SBFrame(%p)::GetSP () => 0x%llx", frame, addr);
+        log->Printf ("SBFrame(%p)::GetSP () => 0x%" PRIx64, frame, addr);
 
     return addr;
 }
@@ -599,7 +599,7 @@
     }
 
     if (log)
-        log->Printf ("SBFrame(%p)::GetFP () => 0x%llx", frame, addr);
+        log->Printf ("SBFrame(%p)::GetFP () => 0x%" PRIx64, frame, addr);
     return addr;
 }
 
diff --git a/source/API/SBFunction.cpp b/source/API/SBFunction.cpp
index 7ac447e..028725c 100644
--- a/source/API/SBFunction.cpp
+++ b/source/API/SBFunction.cpp
@@ -107,7 +107,7 @@
 {
     if (m_opaque_ptr)
     {
-        s.Printf ("SBFunction: id = 0x%8.8llx, name = %s", 
+        s.Printf ("SBFunction: id = 0x%8.8" PRIx64 ", name = %s",
                   m_opaque_ptr->GetID(),
                   m_opaque_ptr->GetName().AsCString());
         Type *func_type = m_opaque_ptr->GetType();
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index 65adbee..9b1dff0 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -224,7 +224,7 @@
     if (log) {
         SBStream sstr;
         error.GetDescription (sstr);
-        log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%llu) => SBError (%p): %s", process_sp.get(), pid, error.get(), sstr.GetData());
+        log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%" PRIu64 ") => SBError (%p): %s", process_sp.get(), pid, error.get(), sstr.GetData());
     }
 
     return error.Success();
@@ -333,7 +333,7 @@
     
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%llu) => %llu", 
+        log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
                      process_sp.get(),
                      (int) bytes_read,
                      dst,
@@ -356,7 +356,7 @@
 
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%llu) => %llu",
+        log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
                      process_sp.get(),
                      (int) bytes_read,
                      dst,
@@ -379,7 +379,7 @@
     
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBProcess(%p)::GetProfileData (dst=\"%.*s\", dst_len=%llu) => %llu",
+        log->Printf ("SBProcess(%p)::GetProfileData (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
                      process_sp.get(),
                      (int) bytes_read,
                      dst,
@@ -402,7 +402,7 @@
         char message[1024];
         int message_len = ::snprintf (message,
                                       sizeof (message),
-                                      "Process %llu %s\n",
+                                      "Process %" PRIu64 " %s\n",
                                       process_sp->GetID(),
                                       SBDebugger::StateAsCString (event_state));
 
@@ -421,7 +421,7 @@
         char message[1024];
         ::snprintf (message,
                     sizeof (message),
-                    "Process %llu %s\n",
+                    "Process %" PRIu64 " %s\n",
                     process_sp->GetID(),
                     SBDebugger::StateAsCString (event_state));
 
@@ -455,7 +455,7 @@
     }
 
     if (log)
-        log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%4.4llx) => %s", 
+        log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%4.4" PRIx64 ") => %s",
                      process_sp.get(), tid, (ret_val ? "true" : "false"));
 
     return ret_val;
@@ -574,7 +574,7 @@
 
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBProcess(%p)::GetProcessID () => %llu", process_sp.get(), ret_val);
+        log->Printf ("SBProcess(%p)::GetProcessID () => %" PRIu64, process_sp.get(), ret_val);
 
     return ret_val;
 }
@@ -802,7 +802,7 @@
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
-        log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4llx) => SBThread (%p)", 
+        log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4" PRIx64 ") => SBThread (%p)",
                      process_sp.get(), 
                      tid,
                      thread_sp.get());
@@ -904,7 +904,7 @@
 
     if (log)
     {
-        log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%llu, SBError (%p))...",
+        log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%" PRIx64 ", dst=%p, dst_len=%" PRIu64 ", SBError (%p))...",
                      process_sp.get(), 
                      addr, 
                      dst, 
@@ -936,7 +936,7 @@
     {
         SBStream sstr;
         sb_error.GetDescription (sstr);
-        log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%llx, dst=%p, dst_len=%llu, SBError (%p): %s) => %llu", 
+        log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%" PRIx64 ", dst=%p, dst_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64,
                      process_sp.get(), 
                      addr, 
                      dst, 
@@ -1044,7 +1044,7 @@
 
     if (log)
     {
-        log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, src_len=%llu, SBError (%p))...",
+        log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p))...",
                      process_sp.get(), 
                      addr, 
                      src, 
@@ -1072,7 +1072,7 @@
     {
         SBStream sstr;
         sb_error.GetDescription (sstr);
-        log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, src_len=%llu, SBError (%p): %s) => %llu",
+        log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64,
                      process_sp.get(), 
                      addr, 
                      src, 
@@ -1100,7 +1100,7 @@
         if (exe_module)
             exe_name = exe_module->GetFileSpec().GetFilename().AsCString();
 
-        strm.Printf ("SBProcess: pid = %llu, state = %s, threads = %d%s%s", 
+        strm.Printf ("SBProcess: pid = %" PRIu64 ", state = %s, threads = %d%s%s",
                      process_sp->GetID(),
                      lldb_private::StateAsCString (GetState()), 
                      GetNumThreads(),
diff --git a/source/API/SBSection.cpp b/source/API/SBSection.cpp
index 0f55f01..0b98ddb 100644
--- a/source/API/SBSection.cpp
+++ b/source/API/SBSection.cpp
@@ -264,7 +264,7 @@
     if (section_sp)
     {
         const addr_t file_addr = section_sp->GetFileAddress();
-        strm.Printf ("[0x%16.16llx-0x%16.16llx) ", file_addr, file_addr + section_sp->GetByteSize());
+        strm.Printf ("[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") ", file_addr, file_addr + section_sp->GetByteSize());
         section_sp->DumpName(&strm);
     }
     else
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 071c4b5..611da77 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -876,7 +876,7 @@
                     }
                     else
                     {
-                        error.ref().SetErrorStringWithFormat("no process found with process ID %llu", attach_pid);
+                        error.ref().SetErrorStringWithFormat("no process found with process ID %" PRIu64, attach_pid);
                         if (log)
                         {
                             log->Printf ("SBTarget(%p)::Attach (...) => error %s",
@@ -944,7 +944,7 @@
 
     if (log)
     {
-        log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%lld, error)...", target_sp.get(), pid);
+        log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...", target_sp.get(), pid);
     }
     
     if (target_sp)
@@ -1487,7 +1487,7 @@
     
     if (log)
     {
-        log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%llu) => SBBreakpoint(%p)", target_sp.get(), (uint64_t) address, sb_bp.get());
+        log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)", target_sp.get(), (uint64_t) address, sb_bp.get());
     }
 
     return sb_bp;
@@ -1792,7 +1792,7 @@
     
     if (log)
     {
-        log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%llx, 0x%u) => SBWatchpoint(%p)", 
+        log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%" PRIx64 ", 0x%u) => SBWatchpoint(%p)",
                      target_sp.get(), addr, (uint32_t) size, watchpoint_sp.get());
     }
     
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index f895a3d..4dd29d7 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -715,7 +715,7 @@
 
 
     if (log)
-        log->Printf ("SBThread(%p)::RunToAddress (addr=0x%llx)", exe_ctx.GetThreadPtr(), addr);
+        log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")", exe_ctx.GetThreadPtr(), addr);
     
     if (exe_ctx.HasThreadScope())
     {
@@ -1185,7 +1185,7 @@
     ExecutionContext exe_ctx (m_opaque_sp.get());
     if (exe_ctx.HasThreadScope())
     {
-        strm.Printf("SBThread: tid = 0x%4.4llx", exe_ctx.GetThreadPtr()->GetID());
+        strm.Printf("SBThread: tid = 0x%4.4" PRIx64, exe_ctx.GetThreadPtr()->GetID());
     }
     else
         strm.PutCString ("No value");
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 2e4be07..27b4608 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -301,7 +301,7 @@
     }
 
     if (log)
-        log->Printf ("SBValue(%p)::GetByteSize () => %llu", value_sp.get(), (uint64_t)result);
+        log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64, value_sp.get(), (uint64_t)result);
 
     return result;
 }
@@ -1755,7 +1755,7 @@
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBValue(%p)::GetLoadAddress () => (%llu)", value_sp.get(), value);
+        log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")", value_sp.get(), value);
     
     return value;
 }
@@ -1792,7 +1792,7 @@
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBValue(%p)::GetAddress () => (%s,%llu)", value_sp.get(),
+        log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")", value_sp.get(),
                      (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"),
                      addr.GetOffset());
     return SBAddress(new Address(addr));