[Lldb-commits] [lldb] r143244 - in /lldb/trunk/tools/debugserver/source: DNB.cpp DNBBreakpoint.cpp DNBLog.cpp DNBLog.h MacOSX/MachException.cpp MacOSX/MachException.h MacOSX/MachProcess.cpp MacOSX/MachTask.cpp MacOSX/MachThread.cpp MacOSX/i386/DNBArchImplI386.cpp MacOSX/x86_64/DNBArchImplX86_64.cpp RNBSocket.cpp debugserver.cpp

Greg Clayton gclayton at apple.com
Fri Oct 28 15:59:14 PDT 2011


Author: gclayton
Date: Fri Oct 28 17:59:14 2011
New Revision: 143244

URL: http://llvm.org/viewvc/llvm-project?rev=143244&view=rev
Log:
Enabled the "printf" attribute on all debugserver logging functions and fixed 
the ensuing mayhem.


Modified:
    lldb/trunk/tools/debugserver/source/DNB.cpp
    lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp
    lldb/trunk/tools/debugserver/source/DNBLog.cpp
    lldb/trunk/tools/debugserver/source/DNBLog.h
    lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
    lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
    lldb/trunk/tools/debugserver/source/RNBSocket.cpp
    lldb/trunk/tools/debugserver/source/debugserver.cpp

Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Fri Oct 28 17:59:14 2011
@@ -286,7 +286,7 @@
     }
     else if (num_matching_proc_infos > 1)
     {
-        DNBLogError ("error: %u processes match '%s':\n", num_matching_proc_infos, name);
+        DNBLogError ("error: %zu processes match '%s':\n", num_matching_proc_infos, name);
         size_t i;
         for (i=0; i<num_matching_proc_infos; ++i)
             DNBLogError ("%6u - %s\n", matching_proc_infos[i].kp_proc.p_pid, matching_proc_infos[i].kp_proc.p_comm);

Modified: lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp Fri Oct 28 17:59:14 2011
@@ -77,34 +77,34 @@
 {
     if (IsBreakpoint())
     {
-        DNBLog("DNBBreakpoint %u: tid = %4.4x  addr = %8.8p  state = %s  type = %s breakpoint  hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %8.8p baton = %8.8p",
-            m_breakID,
-            m_tid,
-            m_addr,
-            m_enabled ? "enabled " : "disabled",
-            IsHardware() ? "hardware" : "software",
-            GetHardwareIndex(),
-            GetHitCount(),
-            GetIgnoreCount(),
-            m_callback,
-            m_callback_baton);
+        DNBLog ("DNBBreakpoint %u: tid = %4.4x  addr = 0x%llx  state = %s  type = %s breakpoint  hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %p baton = %p",
+                m_breakID,
+                m_tid,
+                (uint64_t)m_addr,
+                m_enabled ? "enabled " : "disabled",
+                IsHardware() ? "hardware" : "software",
+                GetHardwareIndex(),
+                GetHitCount(),
+                GetIgnoreCount(),
+                m_callback,
+                m_callback_baton);
     }
     else
     {
-        DNBLog("DNBBreakpoint %u: tid = %4.4x  addr = %8.8p  size = %u  state = %s  type = %s watchpoint (%s%s)  hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %8.8p baton = %8.8p",
-            m_breakID,
-            m_tid,
-            m_addr,
-            m_byte_size,
-            m_enabled ? "enabled " : "disabled",
-            IsHardware() ? "hardware" : "software",
-            m_watch_read ? "r" : "",
-            m_watch_write ? "w" : "",
-            GetHardwareIndex(),
-            GetHitCount(),
-            GetIgnoreCount(),
-            m_callback,
-            m_callback_baton);
+        DNBLog ("DNBBreakpoint %u: tid = %4.4x  addr = 0x%llx  size = %zu  state = %s  type = %s watchpoint (%s%s)  hw_index = %i  hit_count = %-4u  ignore_count = %-4u  callback = %p baton = %p",
+                m_breakID,
+                m_tid,
+                (uint64_t)m_addr,
+                m_byte_size,
+                m_enabled ? "enabled " : "disabled",
+                IsHardware() ? "hardware" : "software",
+                m_watch_read ? "r" : "",
+                m_watch_write ? "w" : "",
+                GetHardwareIndex(),
+                GetHitCount(),
+                GetIgnoreCount(),
+                m_callback,
+                m_callback_baton);
     }
 }
 

Modified: lldb/trunk/tools/debugserver/source/DNBLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBLog.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNBLog.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNBLog.cpp Fri Oct 28 17:59:14 2011
@@ -185,7 +185,7 @@
                 timersub (&tv, &g_timeval, &delta);
             }
             g_timeval = tv;
-            _DNBLog (DNBLOG_FLAG_THREADED, "%u +%u.%06u sec [%4.4x/%4.4x]: %s", 
+            _DNBLog (DNBLOG_FLAG_THREADED, "%u +%lu.%06u sec [%4.4x/%4.4x]: %s", 
                      ++g_message_id, 
                      delta.tv_sec, 
                      delta.tv_usec,             
@@ -230,7 +230,7 @@
                 timersub (&tv, &g_timeval, &delta);
             }
             g_timeval = tv;
-            _DNBLog (DNBLOG_FLAG_THREADED, "%u +%u.%06u sec [%4.4x/%4.4x]: %s", 
+            _DNBLog (DNBLOG_FLAG_THREADED, "%u +%lu.%06u sec [%4.4x/%4.4x]: %s", 
                      ++g_message_id, 
                      delta.tv_sec, 
                      delta.tv_usec, 

Modified: lldb/trunk/tools/debugserver/source/DNBLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBLog.h?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNBLog.h (original)
+++ lldb/trunk/tools/debugserver/source/DNBLog.h Fri Oct 28 17:59:14 2011
@@ -36,16 +36,16 @@
 
 #define DNB_EXPORT __attribute__((visibility("default")))
 
-void        _DNBLog(uint32_t flags, const char *format, ...) DNB_EXPORT;
-void        _DNBLogDebug (const char *fmt, ...) DNB_EXPORT;
-void        _DNBLogDebugVerbose (const char *fmt, ...) DNB_EXPORT;
-void        _DNBLogThreaded (const char *fmt, ...) DNB_EXPORT;
-void        _DNBLogThreadedIf (uint32_t mask, const char *fmt, ...) DNB_EXPORT;
-void        _DNBLogError (const char *fmt, ...) DNB_EXPORT;
-void        _DNBLogFatalError (int err, const char *fmt, ...) DNB_EXPORT;
-void        _DNBLogVerbose (const char *fmt, ...) DNB_EXPORT;
-void        _DNBLogWarning (const char *fmt, ...) DNB_EXPORT;
-void        _DNBLogWarningVerbose (const char *fmt, ...) DNB_EXPORT;
+void        _DNBLog(uint32_t flags, const char *format, ...) __attribute__ ((format (printf, 2, 3))) DNB_EXPORT;
+void        _DNBLogDebug (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) DNB_EXPORT;
+void        _DNBLogDebugVerbose (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) DNB_EXPORT;
+void        _DNBLogThreaded (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) DNB_EXPORT;
+void        _DNBLogThreadedIf (uint32_t mask, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))) DNB_EXPORT;
+void        _DNBLogError (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) DNB_EXPORT;
+void        _DNBLogFatalError (int err, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))) DNB_EXPORT;
+void        _DNBLogVerbose (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) DNB_EXPORT;
+void        _DNBLogWarning (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) DNB_EXPORT;
+void        _DNBLogWarningVerbose (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) DNB_EXPORT;
 bool        DNBLogCheckLogBit (uint32_t bit) DNB_EXPORT;
 uint32_t    DNBLogSetLogMask (uint32_t mask) DNB_EXPORT;
 uint32_t    DNBLogGetLogMask () DNB_EXPORT;

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp Fri Oct 28 17:59:14 2011
@@ -95,12 +95,12 @@
 {
     if (DNBLogCheckLogBit(LOG_EXCEPTIONS))
     {
-        DNBLogThreaded("::%s ( exc_port = 0x%4.4x, exc_type = %d ( %s ), exc_data = " MACH_EXCEPTION_DATA_FMT_HEX ", exc_data_count = %d)",
-            __FUNCTION__,
-            exc_port,
-            exc_type, MachException::Name(exc_type),
-            exc_data,
-            exc_data_count);
+        DNBLogThreaded ("::%s ( exc_port = 0x%4.4x, exc_type = %d ( %s ), exc_data = 0x%llx, exc_data_count = %d)",
+                        __FUNCTION__,
+                        exc_port,
+                        exc_type, MachException::Name(exc_type),
+                        (uint64_t)exc_data,
+                        exc_data_count);
     }
     return KERN_FAILURE;
 }
@@ -125,15 +125,15 @@
     kern_return_t kret;
     if (DNBLogCheckLogBit(LOG_EXCEPTIONS))
     {
-        DNBLogThreaded("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { " MACH_EXCEPTION_DATA_FMT_HEX ",  " MACH_EXCEPTION_DATA_FMT_HEX " })",
+        DNBLogThreaded("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { 0x%llx, 0x%llx })",
             __FUNCTION__,
             exc_port,
             thread_port,
             task_port,
             exc_type, MachException::Name(exc_type),
             exc_data_count,
-            exc_data_count > 0 ? exc_data[0] : 0xBADDBADD,
-            exc_data_count > 1 ? exc_data[1] : 0xBADDBADD);
+            (uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD),
+            (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD));
     }
     kret = mach_port_deallocate (mach_task_self (), task_port);
     kret = mach_port_deallocate (mach_task_self (), thread_port);
@@ -154,15 +154,15 @@
 {
     if (DNBLogCheckLogBit(LOG_EXCEPTIONS))
     {
-        DNBLogThreaded("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { " MACH_EXCEPTION_DATA_FMT_HEX ",  " MACH_EXCEPTION_DATA_FMT_HEX " })",
-            __FUNCTION__,
-            exc_port,
-            thread_port,
-            task_port,
-            exc_type, MachException::Name(exc_type),
-            exc_data_count,
-            exc_data_count > 0 ? exc_data[0] : 0xBADDBADD,
-            exc_data_count > 1 ? exc_data[1] : 0xBADDBADD);
+        DNBLogThreaded ("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { 0x%llx, 0x%llx })",
+                        __FUNCTION__,
+                        exc_port,
+                        thread_port,
+                        task_port,
+                        exc_type, MachException::Name(exc_type),
+                        exc_data_count,
+                        (uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD),
+                        (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD));
     }
 
     g_message->task_port = task_port;
@@ -178,7 +178,7 @@
 MachException::Message::Dump() const
 {
     DNBLogThreadedIf(LOG_EXCEPTIONS,
-        "  exc_msg { bits = 0x%8.8lx size = 0x%8.8lx remote-port = 0x%8.8lx local-port = 0x%8.8lx reserved = 0x%8.8lx id = 0x%8.8lx } ",
+        "  exc_msg { bits = 0x%8.8x size = 0x%8.8x remote-port = 0x%8.8x local-port = 0x%8.8x reserved = 0x%8.8x id = 0x%8.8x } ",
         exc_msg.hdr.msgh_bits,
         exc_msg.hdr.msgh_size,
         exc_msg.hdr.msgh_remote_port,
@@ -187,7 +187,7 @@
         exc_msg.hdr.msgh_id);
 
     DNBLogThreadedIf(LOG_EXCEPTIONS,
-        "reply_msg { bits = 0x%8.8lx size = 0x%8.8lx remote-port = 0x%8.8lx local-port = 0x%8.8lx reserved = 0x%8.8lx id = 0x%8.8lx }",
+        "reply_msg { bits = 0x%8.8x size = 0x%8.8x remote-port = 0x%8.8x local-port = 0x%8.8x reserved = 0x%8.8x id = 0x%8.8x }",
         reply_msg.hdr.msgh_bits,
         reply_msg.hdr.msgh_size,
         reply_msg.hdr.msgh_remote_port,
@@ -237,7 +237,7 @@
             desc += snprintf(desc, end_desc - desc, " data[%zu] = {", stop_info->details.exception.data_count);
 
             for (idx = 0; desc < end_desc && idx < stop_info->details.exception.data_count; ++idx)
-                desc += snprintf(desc, end_desc - desc, MACH_EXCEPTION_DATA_FMT_MINHEX "%c", exc_data[idx], ((idx + 1 == stop_info->details.exception.data_count) ? '}' : ','));
+                desc += snprintf(desc, end_desc - desc, "0x%llx%c", (uint64_t)exc_data[idx], ((idx + 1 == stop_info->details.exception.data_count) ? '}' : ','));
         }
     }
 
@@ -275,19 +275,18 @@
     if (log_exceptions && ((options & MACH_RCV_TIMEOUT) == 0))
     {
         // Dump this log message if we have no timeout in case it never returns
-        DNBLogThreaded("::mach_msg ( msg->{bits = %#x, size = %u remote_port = %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, option = %#x, send_size = %u, rcv_size = %u, rcv_name = %#x, timeout = %u, notify = %#x)",
-                exc_msg.hdr.msgh_bits,
-                exc_msg.hdr.msgh_size,
-                exc_msg.hdr.msgh_remote_port,
-                exc_msg.hdr.msgh_local_port,
-                exc_msg.hdr.msgh_reserved,
-                exc_msg.hdr.msgh_id,
-                options,
-                0,
-                sizeof (exc_msg.data),
-                port,
-                mach_msg_timeout,
-                notify_port);
+        DNBLogThreaded ("::mach_msg ( msg->{bits = %#x, size = %u remote_port = %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, option = %#x, send_size = 0, rcv_size = %zu, rcv_name = %#x, timeout = %u, notify = %#x)",
+                        exc_msg.hdr.msgh_bits,
+                        exc_msg.hdr.msgh_size,
+                        exc_msg.hdr.msgh_remote_port,
+                        exc_msg.hdr.msgh_local_port,
+                        exc_msg.hdr.msgh_reserved,
+                        exc_msg.hdr.msgh_id,
+                        options,
+                        sizeof (exc_msg.data),
+                        port,
+                        mach_msg_timeout,
+                        notify_port);
     }
 
     err = ::mach_msg (&exc_msg.hdr,
@@ -461,7 +460,7 @@
         size_t idx;
         for (idx = 0; idx < exc_data_count; ++idx)
         {
-            DNBLogThreadedIf(LOG_EXCEPTIONS, "            exc_data[%u]: " MACH_EXCEPTION_DATA_FMT_HEX, idx, exc_data[idx]);
+            DNBLogThreadedIf(LOG_EXCEPTIONS, "            exc_data[%zu]: 0x%llx", idx, (uint64_t)exc_data[idx]);
         }
     }
 }

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachException.h?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachException.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachException.h Fri Oct 28 17:59:14 2011
@@ -19,20 +19,6 @@
 #include <vector>
 #include "DNBConfig.h"
 
-#ifdef HAVE_64_BIT_MACH_EXCEPTIONS
-
-#define MACH_EXCEPTION_DATA_FMT_DEC "%lld"
-#define MACH_EXCEPTION_DATA_FMT_HEX "0x%16.16llx"
-#define MACH_EXCEPTION_DATA_FMT_MINHEX "0x%llx"
-
-#else
-
-#define MACH_EXCEPTION_DATA_FMT_DEC "%d"
-#define MACH_EXCEPTION_DATA_FMT_HEX "0x%8.8x"
-#define MACH_EXCEPTION_DATA_FMT_MINHEX "0x%x"
-
-#endif
-
 class MachProcess;
 class PThreadMutex;
 

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Fri Oct 28 17:59:14 2011
@@ -343,7 +343,7 @@
     ::ptrace (PT_KILL, m_pid, 0, 0);
     DNBError err;
     err.SetErrorToErrno();
-    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Kill() DoSIGSTOP() ::ptrace (PT_KILL, pid=%u, 0, 0) => 0x%8.8x (%s)", err.Error(), err.AsString());
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Kill() DoSIGSTOP() ::ptrace (PT_KILL, pid=%u, 0, 0) => 0x%8.8x (%s)", m_pid, err.Error(), err.AsString());
     m_thread_actions = DNBThreadResumeActions (eStateRunning, 0);
     PrivateResume ();
     return true;
@@ -616,7 +616,7 @@
         MachException::Message::iterator end = m_exception_messages.end();
         for (pos = begin; pos != end; ++pos)
         {
-            DNBLogThreadedIf(LOG_EXCEPTIONS, "Replying to exception %d...", std::distance(begin, pos));
+            DNBLogThreadedIf(LOG_EXCEPTIONS, "Replying to exception %u...", (uint32_t)std::distance(begin, pos));
             int thread_reply_signal = 0;
 
             const DNBThreadResumeAction *action = m_thread_actions.GetActionForThread (pos->state.thread_port, false);
@@ -664,7 +664,7 @@
 nub_break_t
 MachProcess::CreateBreakpoint(nub_addr_t addr, nub_size_t length, bool hardware, thread_t tid)
 {
-    DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %u, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, length, hardware, tid);
+    DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %zu, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, length, hardware, tid);
     if (hardware && tid == INVALID_NUB_THREAD)
         tid = GetCurrentThread();
 
@@ -672,7 +672,7 @@
     nub_break_t breakID = m_breakpoints.Add(bp);
     if (EnableBreakpoint(breakID))
     {
-        DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %u, tid = 0x%4.4x ) => %u", (uint64_t)addr, length, tid, breakID);
+        DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%4.4x ) => %u", (uint64_t)addr, length, tid, breakID);
         return breakID;
     }
     else
@@ -686,7 +686,7 @@
 nub_watch_t
 MachProcess::CreateWatchpoint(nub_addr_t addr, nub_size_t length, uint32_t watch_flags, bool hardware, thread_t tid)
 {
-    DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %u, flags = 0x%8.8x, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, length, watch_flags, hardware, tid);
+    DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, flags = 0x%8.8x, hardware = %i, tid = 0x%4.4x )", (uint64_t)addr, length, watch_flags, hardware, tid);
     if (hardware && tid == INVALID_NUB_THREAD)
         tid = GetCurrentThread();
 
@@ -696,12 +696,12 @@
     nub_watch_t watchID = m_watchpoints.Add(watch);
     if (EnableWatchpoint(watchID))
     {
-        DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %u, tid = 0x%x) => %u", (uint64_t)addr, length, tid, watchID);
+        DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%x) => %u", (uint64_t)addr, length, tid, watchID);
         return watchID;
     }
     else
     {
-        DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %u, tid = 0x%x) => FAILED (%u)", (uint64_t)addr, length, tid, watchID);
+        DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = 0x%8.8llx, length = %zu, tid = 0x%x) => FAILED (%u)", (uint64_t)addr, length, tid, watchID);
         m_watchpoints.Remove(watchID);
     }
     // We failed to enable the watchpoint
@@ -1071,7 +1071,7 @@
 {
     // We have a complete bundle of exceptions for our child process.
     PTHREAD_MUTEX_LOCKER (locker, m_exception_messages_mutex);
-    DNBLogThreadedIf(LOG_EXCEPTIONS, "%s: %d exception messages.", __PRETTY_FUNCTION__, m_exception_messages.size());
+    DNBLogThreadedIf(LOG_EXCEPTIONS, "%s: %zu exception messages.", __PRETTY_FUNCTION__, m_exception_messages.size());
     if (!m_exception_messages.empty())
     {
         // Let all threads recover from stopping and do any clean up based
@@ -1140,7 +1140,7 @@
 void
 MachProcess::AppendSTDOUT (char* s, size_t len)
 {
-    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (<%d> %s) ...", __FUNCTION__, len, s);
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (<%zu> %s) ...", __FUNCTION__, len, s);
     PTHREAD_MUTEX_LOCKER (locker, m_stdio_mutex);
     m_stdout_data.append(s, len);
     m_events.SetEvents(eEventStdioAvailable);
@@ -1152,7 +1152,7 @@
 size_t
 MachProcess::GetAvailableSTDOUT (char *buf, size_t buf_size)
 {
-    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%u]) ...", __FUNCTION__, buf, buf_size);
+    DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%zu]) ...", __FUNCTION__, buf, buf_size);
     PTHREAD_MUTEX_LOCKER (locker, m_stdio_mutex);
     size_t bytes_available = m_stdout_data.size();
     if (bytes_available > 0)

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp Fri Oct 28 17:59:14 2011
@@ -172,7 +172,7 @@
     {
         n = m_vm_memory.Read(task, addr, buf, size);
 
-        DNBLogThreadedIf(LOG_MEMORY, "MachTask::ReadMemory ( addr = 0x%8.8llx, size = %zu, buf = %8.8p) => %u bytes read", (uint64_t)addr, size, buf, n);
+        DNBLogThreadedIf(LOG_MEMORY, "MachTask::ReadMemory ( addr = 0x%8.8llx, size = %zu, buf = %p) => %zu bytes read", (uint64_t)addr, size, buf, n);
         if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) || (DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8))
         {
             DNBDataRef data((uint8_t*)buf, n, false);
@@ -194,7 +194,7 @@
     if (task != TASK_NULL)
     {
         n = m_vm_memory.Write(task, addr, buf, size);
-        DNBLogThreadedIf(LOG_MEMORY, "MachTask::WriteMemory ( addr = 0x%8.8llx, size = %zu, buf = %8.8p) => %u bytes written", (uint64_t)addr, size, buf, n);
+        DNBLogThreadedIf(LOG_MEMORY, "MachTask::WriteMemory ( addr = 0x%8.8llx, size = %zu, buf = %p) => %zu bytes written", (uint64_t)addr, size, buf, n);
         if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) || (DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8))
         {
             DNBDataRef data((uint8_t*)buf, n, false);
@@ -284,8 +284,12 @@
     {
         float user = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f;
         float system = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f;
-        DNBLogThreaded("task_basic_info = { suspend_count = %i, virtual_size = 0x%8.8x, resident_size = 0x%8.8x, user_time = %f, system_time = %f }",
-            info->suspend_count, info->virtual_size, info->resident_size, user, system);
+        DNBLogThreaded ("task_basic_info = { suspend_count = %i, virtual_size = 0x%8.8llx, resident_size = 0x%8.8llx, user_time = %f, system_time = %f }",
+                        info->suspend_count, 
+                        (uint64_t)info->virtual_size, 
+                        (uint64_t)info->resident_size, 
+                        user, 
+                        system);
     }
     return err.Error();
 }

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Fri Oct 28 17:59:14 2011
@@ -349,7 +349,7 @@
     default:                        thread_run_state = "???"; break;
     }
 
-    DNBLogThreaded("[%3u] #%3u tid: 0x%4.4x, pc: 0x%16.16llx, sp: 0x%16.16llx, breakID: %3d, user: %d.%06.6d, system: %d.%06.6d, cpu: %2d, policy: %2d, run_state: %2d (%s), flags: %2d, suspend_count: %2d (current %2d), sleep_time: %d",
+    DNBLogThreaded("[%3u] #%3u tid: 0x%4.4x, pc: 0x%16.16llx, sp: 0x%16.16llx, breakID: %3d, user: %d.%6.6d, system: %d.%6.6d, cpu: %2d, policy: %2d, run_state: %2d (%s), flags: %2d, suspend_count: %2d (current %2d), sleep_time: %d",
         index,
         m_seq_id,
         m_tid,

Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Fri Oct 28 17:59:14 2011
@@ -822,7 +822,7 @@
 uint32_t
 DNBArchImplI386::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
 {
-    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::EnableHardwareWatchpoint(addr = %8.8p, size = %u, read = %u, write = %u)", addr, size, read, write);
+    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::EnableHardwareWatchpoint(addr = 0x%llx, size = %zu, read = %u, write = %u)", (uint64_t)addr, size, read, write);
 
     const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
 
@@ -924,8 +924,8 @@
             {
                 addr = GetWatchAddress(debug_state, i);
                 DNBLogThreadedIf(LOG_WATCHPOINTS,
-                                 "DNBArchImplI386::GetHardwareWatchpointHit() found => %u (addr = %8.8p).",
-                                 i, addr);
+                                 "DNBArchImplI386::GetHardwareWatchpointHit() found => %u (addr = 0x%llx).",
+                                 i, (uint64_t)addr);
                 return i;
             }
         }

Modified: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Fri Oct 28 17:59:14 2011
@@ -749,7 +749,7 @@
 uint32_t
 DNBArchImplX86_64::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
 {
-    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::EnableHardwareWatchpoint(addr = %8.8p, size = %u, read = %u, write = %u)", addr, size, read, write);
+    DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::EnableHardwareWatchpoint(addr = 0x%llx, size = %zu, read = %u, write = %u)", (uint64_t)addr, size, read, write);
 
     const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
 
@@ -851,8 +851,9 @@
             {
                 addr = GetWatchAddress(debug_state, i);
                 DNBLogThreadedIf(LOG_WATCHPOINTS,
-                                 "DNBArchImplX86_64::GetHardwareWatchpointHit() found => %u (addr = %8.8p).",
-                                 i, addr);
+                                 "DNBArchImplX86_64::GetHardwareWatchpointHit() found => %u (addr = 0x%llx).",
+                                 i, 
+                                 (uint64_t)addr);
                 return i;
             }
         }

Modified: lldb/trunk/tools/debugserver/source/RNBSocket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBSocket.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBSocket.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBSocket.cpp Fri Oct 28 17:59:14 2011
@@ -291,8 +291,8 @@
     if (bytessent != length)
         return rnb_err;
 
-    DNBLogThreadedIf(LOG_RNB_PACKETS, "putpkt: %*s", length, (char *)buffer);   // All data is string based in debugserver, so this is safe
-    DNBLogThreadedIf(LOG_RNB_COMM, "sent: %*s", length, (char *)buffer);
+    DNBLogThreadedIf(LOG_RNB_PACKETS, "putpkt: %*s", (int)length, (char *)buffer);   // All data is string based in debugserver, so this is safe
+    DNBLogThreadedIf(LOG_RNB_COMM, "sent: %*s", (int)length, (char *)buffer);
 
     return rnb_success;
 }

Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=143244&r1=143243&r2=143244&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp Fri Oct 28 17:59:14 2011
@@ -447,18 +447,18 @@
 
                     if (ctx.GetProcessStopCount() == 1)
                     {
-                        DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %u (old %u)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+                        DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %zu (old %zu)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
                     }
                     else
                     {
 
-                        DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %u (old %u)) Notify??? YES!!!", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+                        DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %zu (old %zu)) Notify??? YES!!!", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
                         remote->NotifyThatProcessStopped ();
                     }
                 }
                 else
                 {
-                    DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %u (old %u)) Notify??? skipping...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
+                    DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i)  pid_state = %s pid_stop_count %zu (old %zu)) Notify??? skipping...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count);
                 }
             }
             return eRNBRunLoopModeInferiorExecuting;





More information about the lldb-commits mailing list